Build the Sub-Clause List

Your SQL query may use conditions to limit the Query Processor’s search so that it only searches for data that meets certain criteria. The conditions affect the way the query is processed, and so for the first stage of the optimization algorithm, the Query Processor builds a list of sub-clauses (conditions that are separated by AND operators).

Example:

In the following condition, there are two sub-clauses:

( Id = 10 OR Id =12 ) AND Value >= 75.0

The sub-clauses are:

  • ( Id = 10 OR Id =12 )
  • Value >= 75.0

By creating the list of sub-clauses, the Query Processor can avoid any performance inhibiting issues related to the order of the sub-clauses. This is because the sub-clause list allows the Query Processor to use the sub-clauses in any order without affecting the result.

To build the sub-clause list, the Query Processor examines the join specifiers and the WHERE clause in your query:

When the Query Processor has built the sub-clause list, it may transform some of the list entries into one or more equivalent sub-clauses. This process does not affect the syntax of your SQL query, it is simply used to make it easier for the Query Processor to calculate access paths.

The Query Processor will also collate comparisons in your query—it disregards any redundant comparisons, for example, if a sub-clause has >10 and >11, >10 will be ignored as it is made redundant by the >11 . Again, this does not affect the syntax of your query, but allows the Query Processor to handle your query more efficiently.

When the sub-clause list has been built, the Query Processor will categorize the sub-clauses to improve efficiency (see Determine the Sub-Clause Types).

Further Information

Query Clauses with Very Large Numbers


Disclaimer

ClearSCADA 2017 R3