DEFAULT_HAVING_SELECTIVITY_PPM Option

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

Allowed Values

0 – 1000000

Default

0

Scope

Option can be set at the database (PUBLIC) or user level. When set at the database level, the value becomes the default for any new user, but has no impact on existing users. When set at the user level, overrides the PUBLIC value for that user only. No system privilege is required to set option for self. System privilege is required to set at database level or at user level for any user other than self.

Requires the SET ANY PUBLIC OPTION system privilege to set this option. Can be set temporary for an individual connection or for the PUBLIC role. Takes effect immediately.

Remarks

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 Reference: Building Blocks, Tables, and Procedures.