Abstract

The ability to view the size of all your databases can be of great value.

However, there is no command currently provided with IBM Informix Dynamic Server that shows the total size of each of your databases in an instance. If you want to know which databases are using the most space, but do not have a GUI or need an automated script, this article provides an SQL statement that will enable you to view the size of any database you wish to measure .

Content

The following SQL run on the “sysmaster” database returns the totals of allocated and used pages per database:

Copy to Clipboard

The sample output is provided below:

dbsnamekb_allockb_used
demo297784268662
test9722210
example501790395588
stores42323014
sysadmin6345060840
sysmaster 39302538
sysuser29122054
sysutils41842438

For example, the total of all extents (contiguous blocks of disk pages) allocated to tables and indexes in the standard “stores” demo database is 4232 KB, but only 3014 KB of pages within these extents have been consumed so far.

Conclusion

SQL queries on the “sysmaster” database are very useful and sometimes simpler than you might think! Its is a quick and easy way of viewing which databases are using the most space so you can take the necessary steps to address this.

Disclaimer

The code fix suggested above is provided “as is” without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement.

Contact us

If you have any questions or would like to find out more about calculating the size of databases and Informix, simply contact us.

Author