If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Table size

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-12-06, 06:03
anthony_ps anthony_ps is offline
Registered User
 
Join Date: Sep 2006
Posts: 6
Table size

Can someone give me query which will give
me the size of individual tables in a database in MB.

rgds
Reply With Quote
  #2 (permalink)  
Old 10-12-06, 11:50
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
You can get a rough estimate but running either of these in dbaccess, SQL editor, or your favorite SQL tool:

select tabname, ((nrows * rowsize) / 1000000) size
from systables
where tabname = "table_name"

or you could use this:

NOTE: npused is "number of pages used" so you need to know your page size

select tabname, ((npused * your_page_size) / 1000000) size
from systables
where tabname = "table_name"

I prefer to use this one because pages are not 100% filled so there will usually be some unused space per page.
Reply With Quote
  #3 (permalink)  
Old 10-14-06, 01:05
anthony_ps anthony_ps is offline
Registered User
 
Join Date: Sep 2006
Posts: 6
Can u pls let me know how to find the nrows, rowsize
also your_page_size coz im not sure if the one i hav is right.

Rgds,
Anthony.


Quote:
Originally Posted by mjldba
You can get a rough estimate but running either of these in dbaccess, SQL editor, or your favorite SQL tool:

select tabname, ((nrows * rowsize) / 1000000) size
from systables
where tabname = "table_name"

or you could use this:

NOTE: npused is "number of pages used" so you need to know your page size

select tabname, ((npused * your_page_size) / 1000000) size
from systables
where tabname = "table_name"

I prefer to use this one because pages are not 100% filled so there will usually be some unused space per page.
Reply With Quote
  #4 (permalink)  
Old 10-16-06, 12:16
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
The values for "nrows" and "rowsize" can be found (for each specific table) in the table called systables for the database you're querying.

You can determine the page size by running onstat -b and looking at the last line of the output. The page size is the same as buffer size which will be either 2048 (2K pages) or 4096 (4K pages).
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On