DEFAULT_HAVING_SELECTIVITY_PPM option

Function

Provides default selectivity estimates to the optimizer for most HAVING clauses in parts per million.

Allowed values

0 – 1000000

Default

0

Scope

Can be set for an individual connection or the PUBLIC group. Takes effect immediately.

Description

DEFAULT_HAVING_SELECTIVITY_PPM sets the selectivity for HAVING clauses, overriding optimizer estimates. A HAVING clause filters the results of a GROUP BY clause or a query with a select list consisting solely of aggregate functions. When DEFAULT_HAVING_SELECTIVITY_PPM is set to the default of 0, the optimizer estimates how many rows are filtered by the HAVING clause. Sometimes the IQ optimizer does not have sufficient information to choose an accurate selectivity, and in these cases chooses a generic estimate of 40%. DEFAULT_HAVING_SELECTIVITY_PPM allows a user to replace the optimizer estimate for all HAVING predicates in a query.

Users can also specify the selectivity of individual HAVING clauses in the query, as described in the section “User-supplied condition hints” in the “Search conditions” section in Chapter 2, “SQL Language Elements” in Reference: Building Blocks, Tables, and Procedures.

See also

Chapter 3, “Optimizing Queries and Deletions” in the Performance and Tuning Guide