Constraint Sub-Clauses
During the ‘Determine Sub-Clause Type’ phase of the optimization algorithm, the Query Processor identifies any constraint sub-clauses. The constraint sub-clauses in your query are used to limit the number of rows that need to be searched by the Query Processor. As they can significantly reduce the amount of data that has to be searched, constraint sub-clauses can have a major affect on the efficiency of your query.
The Query Processor identifies the constraint sub-clauses by looking in your query for sub-clauses that have the following characteristics:
- They reference a single table
- They have to reference a constraint column (which may be an indexed column). The constraint columns are shown in the table below
- They have to be in a specific form (see table below).
-
Table Type
Constraint Columns
Required Form
Event Journal
Id, Source
Column = Value1
Where Value1 is a constant expression
Event Journal
Id, Source
Column = Value1 OR Column = Value2 OR...
Where Value1 and Value2 are constant expressions and the ... indicates that there may be further components consisting of OR and a constant expression.
Event Journal
Source
Source LIKE Value1
Where Value1 is a constant expression
Event Journal
Source
Source LIKE Value1 OR Source = Value2
Where Value1 and Value2 are constant expressions.
Event Journal
Historic
RecordTime
RecordTime "op" Value1
Where "op" is any comparison operator other than <> and Value1 is a constant expression.
In your query, you can apply one or more constraints to a single column. You can also apply constraints to multiple columns in the same table.
Constraint sub-clauses are not used to determine the access path even if they meet the requirements for an access sub-clause. Also, constraint sub-clauses are not added to a table’s filter condition.
When the Query Processor has identified the constraint sub-clauses in your query, it adds them to an internal list of constraints which is used later in the optimization algorithm.