How to get the size of a informix table?

Viewed 3153

I need to find out how much disk space occupied by a given table. How to see it? Suppose i have a table called tb1. Suppose it is currently using 1000 2kb pages. Then table size should be given as 2000kb.

1 Answers

To add to Jonathan's comment if the table does not store data in blob spaces or smart blob spaces then the oncheck -pt command will give the required information. Look at the "Pagesize" and "Number of pages allocated" information for each fragment.

You can also get this information in SQL with a query such as:

select sum(pagesize * nptotal)
from sysmaster:sysptnhdr
where partnum in
( select partnum from systables
  where tabname = '<table name>'
  union
  select partn from sysfragments f, systables t
  where f.tabid = t.tabid
  and t.tabname = '<table name>' );
Related