Home | Previous Page | Next Page   Tuning Specific Queries and Transactions > Fundamental Query and Transaction Tuning Tasks >

Create and Maintain Data-Distribution Statistics

The optimizer uses the data-distribution statistics that are stored in the sysdistrib system catalog table to determine the lowest-cost query plan. Make sure that you keep these statistics up-to-date so that the optimizer can choose the best query plan.

Generating Statistics on a Table

  1. Identify the set of all columns that appear in any single-column or multi-column index on the table.
  2. Identify the subset that includes all columns that are not the leading column of any index.
  3. Run UPDATE STATISTICS LOW on each column in that subset.

Run UPDATE STATISTICS as follows when tables are updated to ensure that statistics are also updated.

Tip:
For multiprocessor coserver systems, such as those that have four CPUs on each node and as few as eight nodes, UPDATE STATISTICS can execute much faster if you set BUFFERS as high as 25,000 (100 megabytes) on each node. For uniprocessor coserver systems, you can set BUFFERS lower if there are more coserver nodes to do the work.

For detailed information about the syntax and options of the UPDATE STATISTICS statement, refer to the IBM Informix: Guide to SQL Syntax.

For unindexed columns in tables, follow these general guidelines when you run UPDATE STATISTICS:

If columns are indexed, follow these guidelines:

Tip:
To examine the data-distribution information for each column in a table, use the dbschema utility with the following syntax: dbschema -d database -hd tablename, where database is the database name and tablename is the table name.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]