IBM Support

Determining database object size

Question & Answer


Question

How can I determine the size of a particular database object? 

Answer

As part of the Support-contributed toolkit, nz_db_size reports allocated SPU disk usage. By default, nz_db_size checks the entire appliance and produces a usage line for the appliance, each database and every table in that database. To generate this report for a specific database, add the database name to the end of the command line as shown below:

    [nz@cs-spubox2 bin]$ nz_db_size mydatabase

Object Name Bytes KB MB GB TB
Appliance cs-spubox2231,798,630,162226,365,850 221,060215.9 .2
Database MYDATABASE 93,978,000,49291,775,39189,62487.5 .1
Table CRRNT_TIME_DM84000.0
Table SA_CUST_SALES 48,333,013,92047,200,20946,09445.0


nz_db_size reports allocated disk usage which is different than the actual amount being used. Because storage is allocated in 3MB allocations, it is likely that the used bytes will differ. To report on allocated extents, run a command similar to to the following:
    [nz@cs-spubox2 bin]$ nz_db_size mydatabase -extents

And because extents are made up of 128KB pages, you might want to report on page utilization instead. Run a command similar to the following:
    [nz@cs-spubox2 bin]$ nz_db_size mydatabase -pages

All three forms of this command produce the output shown above. You can further customize the output by adding one or more of the following options, which will restrict the columns output to the specified measure of disk:
  • -kb, which reports usage in kilobytes
  • -mb, which reports usage in megabytes
  • -gb, which reports usage in gigabytes
  • -tb, which reports usage in terabytes
You can specify multiple measures of disk. For example, to report on database usage in gigabytes and terabytes, you could run the following command:
    [nz@cs-spubox2 bin]$ nz_db_size mydatabase -gb -tb

The default sort order of the output is alphabetic. Alternatively, you can order the output by descending size by adding the -s option to your command. For example, to list all the objects in mydatabase in descending size order, you could run the following command:
    [nz@cs-spubox2 bin]$ nz_db_size mydatabase -s

You can also generate a database summary report with the -summary option. For example, to list all the databases in descending size order:
    [nz@cs-spubox2 bin]$ nz_db_size -summary -s

You can also generate this report for a singular table. To do this, simply add the table name after the database argument. The following example reports on one table with sizes shown in gigabytes:
    [nz@cs-spubox2 bin]$ nz_db_size mydatabase sa_cust_sales

Object Name GB
Appliance cs-spubox2215.9
Database MYDATABASE 87.5
Table SA_CUST_SALES 45.0

For additional help, run the help command for the script as follows:
    nz_db_size -h
[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Database","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

NZ542732

Document Information

More support for:
IBM PureData System

Software version:
1.0.0

Document number:
462447

Modified date:
17 October 2019

UID

swg21570148