Provides the source for selectivity estimates used by the query optimizer.
ESTIMATE_SOURCE( column-name [, value [, relation-string ] ] )
column-name The name of the column that is being investigated.
value The value to which the column is compared. The default is NULL.
relation-string The comparison operator used for the comparison, enclosed in single quotes. Possible values for this parameter are: '=' , '>' , '<' , '>=' , '<=' , '<>' , '!=' , '!<' , and '!>'. The default is '='.
The following list shows the selectivity estimate sources that ESTIMATE_SOURCE returns. For more information about the sources, see Selectivity estimate sources.
Value | Selectivity estimate source |
---|---|
Statistics | Stored column statistics |
Column | Average of all values stored in the column statistics |
Index | Index probes |
Guess | Built-in guesses that are defined for each type of predicate. This is returned only when there is no relevant index to use, no statistics have been collected for the referenced columns, or the predicate is a complex predicate. |
Computed | Other sources than the ones described above |
Always | Returned when the specified predicate is always true |
Combined | One or more of the above sources |
Bounded | Returned when there are upper and/or lower bounds placed on the selectivity estimate |
This function returns the source of the selectivity estimate for the predicate column-name relation-string value
. If value is NULL and the relation string is '=', the selectivity source is for the predicate column-name IS NULL
. If value is NULL and the relation string is '!=' or '<>', the selectivity source is for the predicate column-name IS NOT NULL
.
SQL/2008 Vendor extension.
The following statement returns the selectivity source Index for evaluating whether the first value in the EmployeeID column is greater than 200. Returning Index means that the query optimizer used an index to estimate the selectivity.
SELECT FIRST ESTIMATE_SOURCE( EmployeeID, 200, '>' ) FROM Employees ORDER BY 1; |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |