title: How to know postgres table column size
body: <p>I have a query which works on a loop and that queries 30K rows each time from DB. This works fine for certain type of data (let us call the group as company), so company A and B data are comparatively small in table but for company C the size is very huge.
  for 30000 rows company A and B size is around 24 MB , but for company C it is 700 MB. Because of this scenario system started running out of memory for company C.</p>
  
  <p>Now i have left with reducing fetch size from 30K to 5K so that company C also will be fetched without any issues. </p>
  
  <p>I want this to happen dynamically because for company A and B if i reduce to 5K the DB traffic can increase drastically where it requires only for company C.</p>
  
  <p>So i need to develop a code which can know company A,B,C's maximum column size (a BLOB) so based on the size i can decide 30K or 5K as the fetch size.</p>
  
  <p>The whole code is in Java, Hibernate and Postgres</p>