SQL Server 6.5 Performance Optimization and Tuning Handbook

Section 4.2.1: The First Step: Query Analysis

4.2.1 The First Step: Query Analysis

The first step that the query optimizer performs during the query optimization phase is query analysis. In this step the query optimizer examines the query for search arguments (SARGs), the use of the OR operator and join conditions.

4.2.1.1 Search Arguments

A search argument is that part of a query that restricts the result set. If indexes have been chosen carefully, an index can be used to support the search argument. Examples of search arguments are:

   account_no = 7665332   balance > 30   lname = 'Burrows'

The AND operator can be used to connect conditions so another example of a valid search argument would be:

    balance > 30 AND lname = 'Burrows'

Examples of common operators that are valid in a search argument are =, >, <, <= and >=. Other operators such as BETWEEN and LIKE are also valid because the query optimizer can represent them with the common operators listed above. For example, a BETWEEN can always be represented as >= AND <=. For example:

   balance BETWEEN 1000 AND 10000

becomes:

   balance >= 1000 AND balance <= 10000

A LIKE can always be represented as >= AND < For example:

   lname LIKE 'Burr%'

becomes:

   lname >= 'Burr' AND lname < 'Burs'
Hint

The expression balance BETWEEN 1000 AND 10000 is not equivalent to balance BETWEEN 10000 AND 1000.

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Network Monitoring Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.