New database option DEFAULT_HAVING_SELECTIVITY

Function

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

Allowed values

0 to 100

Scope

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

Default

0

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 will be filtered by the HAVING clause. Sometimes the IQ optimizer does not have sufficient information to choose an accurate selectivity, and in these cases will choose 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 estimates” of the “Search conditions” section in Chapter 3, “SQL Language Elements.”

See also

Chapter 3, “Improving Query Performance” in the Sybase IQ Performance and Tuning Guide

NoteThis option was omitted from the chapter “Database Options” in the Sybase IQ Reference Manual.