ER/Studio Model Repository Database Sizing Guide for IBM DB2

by Nov 4, 2015

Howdy!

In this final installment, I will be covering on how to ensure optimum model repository performance for IBM DB2.

[Update Statistics]

RUNSTATS command

Updates statistics in the system catalog about the characteristics of a table and/or associated indexes, or statistical views. These characteristics include number of records, number of pages, and average record length. The optimizer uses these statistics when determining access paths to the data.

  1. Collect statistics on the table only, on all columns without distribution statistics: 
  2. Collect statistics on the table only, on columns empid and empname with distribution statistics: 
  3. Collect statistics on the table only, on all columns with distribution statistics using a specified number of frequency limit for the table while picking the num_quantilesfrom the configuration setting: 
  4. Collect statistics on the table only, on all columns with distribution statistics, and on column group JOB, WORKDEPT, and SEX:
  5. Collect statistics on a set of indexes: 
  6. Collect basic statistics on all indexes only: 
  7. Collect basic statistics on the table and all indexes using sampling for the detailed index statistics collection: 
  8. Collect statistics on table, with distribution statistics on columns empid, empname and empdept and the two indexes Xempid and Xempname. Distribution statistics limits are set individually for empdept, while the other two columns use a common default: 
  9. Collect statistics on all columns used in indexes and on all indexes:
  10. Collect statistics on all indexes and all columns without distribution except for one column. Consider T1 containing columns c1, c2, …., c8 
  11. Collect statistics on table T1 for the individual columns c1 and c5 as well as on the column groups (c2, c3) and (c2, c4). Multicolumn cardinality is very useful to the query optimizer when it estimates filter factors for predicates on columns in which the data is correlated. 
  12. Collect statistics on table T1 for the individual columns c1 and c2. For column c1 also collect the LIKE predicate statistics. 
  13. Register a statistics profile to collect statistics on the table only, on all columns with distribution statistics using a specified number of frequency limit for the table while picking the num_quantiles from the configuration setting. The command also updates the statistics as specified. 
  14. Register a statistics profile to collect statistics on the table only, on all columns with distribution statistics using a specified number of frequency limit for the table while picking the num_quantiles from the configuration setting. Statistics are not collected. 
  15. Modify the previously registered statistics profile by changing the NUM_FREQVALUES value from 50 to 30. The command also updates the statistics as specified. 
  16. Modify the previously registered statistics profile by changing the NUM_FREQVALUES value from 50 to 30. Statistics are not collected. 
  17. Modify the previously registered statistics profile by adding column  and column group (, ) options. The command also updates the statistics as specified. 
  18. Modify the previously registered statistics profile by adding column  and column group (, ) options. Statistics are not collected. 
  19. Collect statistics on a table using the options recorded in the statistics profile for that table: 
  20. Query the RUNSTATS command options corresponding to the previously registered statistics profile stored in the catalogs of the table: 
  21. Collect statistics, including distribution statistics, on 30 percent of the rows: 
  22. To control the sample set on which statistics will be collected and to be able to repeatedly use the same sample set, you can do so as follows:  Issuing the same statement as above will result in the same set of statistics as long as the data has not changed in the interim.
  23. Collect index statistics as well as table statistics on 1.5 percent of the data pages. Only table data pages and not index pages are sampled. In this example 1.5 percent of table data pages are used for the collection of table statistics, while for index statistics all the index pages will be used: 
  24. Collect statistics for a statistical view, on all columns, without distribution statistics:
  25. Collect statistics for a statistical view, with distribution statistics on the columns ,  and . Distribution statistics limits are set for the  column, while the other columns use a common default:
  26. Collect statistics, including distribution statistics, on 10 percent of the rows using row level sampling:
  27. Collect statistics, including distribution statistics, on 2.5 percent of the rows using data page level sampling. Additionally, specify the repeated use of the same sample set. For this command to succeed, the query must be such that the DB2 database system can successfully push data page sampling down to one or more tables. Otherwise, an error (SQL 20288N) is issued. 
  28. Register a statistics profile to collect statistics on the view and on all columns with distribution statistics as specified:
  29. Modify the previously registered statistics profile. This command also updates the statistics as specified:

 

[Source: IBM DB2 Documentation]

[Perform Table Re-Orgs and Index Re-Orgs]

Before you perform a Table Re-Org, make sure you run the REORGCHK command.

REORG TABLE commands and REORG INDEXES ALL commands can be issued on a data partitioned table to concurrently reorganize different data partitions or partitioned indexes on a partition. When concurrently reorganizing data partitions or the partitioned indexes on a partition, users can access the unaffected partitions but cannot access the affected partitions. All the following criteria must be met to issue REORG commands that operate concurrently on the same table:

  • Each REORG command must specify a different partition with the ON DATA PARTITION clause.
  • Each REORG command must use the ALLOW NO ACCESS mode to restrict access to the data partitions.
  • The partitioned table must have only partitioned indexes if issuing REORG TABLE commands. No non-partitioned indexes (except system-generated XML path indexes) can be defined on the table.

    [Source: IBM Knowledge base]

 

Again as always, ensure these are run during non-production hours and this will ensure a smooth running of your ER/Studio Model Repository IBM DB2 Database!

Stay tuned for more posts on our products!