Information gathering
After you identify a query with slow SQL execution, you need to obtain several items of information to best remedy the problem.
Here are the items of information that you need:
- A query execution plan to see what indexes if any are used for the query.
- The DDL for the tables that are involved in the query.
- The row counts for the tables.
- The distribution of the properties that are involved in the query
so that skew and selectivity can be known. Database administrator
techniques can be used to gather the distributions and cardinality
of values, such as issuing DB2Look on DB2 or similar queries of the
statistics. Also, the following explicit query method can be used:
SELECT count(*) FROM <TABLE> SELECT count(*), uxy_property FROM <TABLE> GROUP by uxy_property ORDER BY 1 descSubstitute the relevant table names for
<table>and the relevant column names foruxy_property.