Db2 Sorting Test

Sorting represents organizing the rows in a table into the order of one or more of its columns, optionally eliminating duplicate entries. Sorting is required when:

  • No index exists to satisfy a requested ordering (for example a SELECT statement that uses the ORDER BY clause).
  • An index exists but sorting would be more efficient than using the index
  • An index is created.
  • An index is dropped, which causes index page numbers to be sorted.

Because queries often require sorted or grouped results, sorting is often required, and the proper configuration of the sort heap areas is crucial to good query performance. Using the Db2Sort test, administrators can figure out whether/not the sort heap allocations are sufficient to facilitate efficient sorting.

Target of the test : A DB2 database server

Agent deploying the test : An internal agent

Outputs of the test : One set of results for every database on the DB2 database server that is currently active

Configurable parameters for the test
  1. TEST PERIOD – How often should the test be executed
  2. HostThe IP address of the DB2 server
  3. PortThe port number through which the DB2 server communicates. The default port is 50000.
  4. user - Specify the name of the user who has any of the following privileges to the specified DATABASE: SYSADM or SYSCTRL or SYSMAINT or SYSMON. You can create a separate user on the OS hosting the DB2 server for this purpose, and assign any of the aforesaid privileges to that user. The steps for the same are detailed in the Creating a Special User for Monitoring DB2.
  5. password - Enter the password of the specified USER in the PASSWORD text box.
  6. confirm password – Confirm the password by retyping it here.
  7. database - Specify the name of the database on the monitored DB2 server to be used by this test
Measurements made by the test:
Measurement Description Measurement Unit Interpretation

Sort Heap Allocated:

Indicates the sum of sort heap space allocated for all sorts in all active databases in the database manager.

Pages

Normal memory estimates do not include sort heap space. If excessive sorting is occurring, the extra memory used for the sort heap should be added to the base memory requirements for running the database manager. Generally, the larger the sort heap, the more efficient the sort. Appropriate use of indexes can reduce the amount of sorting required. You may use the information returned at the database manager level to help you tune the SHEAPTHRES configuration parameter. If the element value is greater than or equal to SHEAPTHRES, it means that the sorts are not getting the full sort heap as defined by the SORTHEAP parameter.

Average Sort Heap Space Used:

Indicates the average sort heap space used by each sort.

Pages

If the SORTHEAP configuration parameter is substantially larger than the average sort heap used, you may be able to lower the value of this parameter.

Sort Rate:

Indicates the number of sort operations performed during the last measurement period.

Sorts / Sec

 

Percent Sort Overflow:

Indicates the percentage of sorts that had to overflow to disk.

Percent

Sort overflows are sorts that ran out of sort heap and may have required disk space for temporary storage. When a sort overflows, additional overhead will be incurred because the sort will require a merge phase and can potentially require more I/O, if data needs to be written to disk. If this percentage is high, you may want to adjust the database configuration by increasing the value of sortheap.

Average Sort Time:

Indicates the average sort time for all sorts performed by all applications connected to a particular database.

Secs

A high value indicates the poor performance of sorting operations. Identify the statements that spend lot of time sorting. You may want to reduce the average sort time for these statements by increasing the sortheap parameter.