DEFAULT_HAVING_SELECTIVITY option

Function

Provides default selectivity estimates to the optimizer for most HAVING clauses.

Allowed values

0 – 100

Default

0

Scope

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

Description

DEFAULT_HAVING_SELECTIVITY 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 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 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, Chapter 3, “SQL Language Elements.”

See also

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