Consultor Eletrônico



Kbase P117826: What are OpenEdge SQL index hints?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/29/2010
Status: Verified

GOAL:

What are OpenEdge SQL index hints?

GOAL:

How to use SQL index hints

GOAL:

What is the syntax for OpenEdge SQL index hints?

GOAL:

How to specify which index to use in a SQL query

GOAL:

How does the OpenEdge SQL Optimizer use index hints?

FACT(s) (Environment):

All Supported Operating Systems
OpenEdge 10.x

FIX:

OpenEdge 10 supports index hints for SQL. For each table in the FROM clause of a SELECT query, the user can optionally specify an index. The syntax for specifying an index hint is as follows:


SELECT column_list
FROM table_name [ [ AS ] table_alias ]
[ WITH (INDEX ( index_val ))] , ...
WHERE ...
For example:

SELECT *
FROM pub.Customer WITH (INDEX (CountryPost))
WHERE Country = 'USA';

When the OpenEdge SQL Engine optimizes a query, it will generate an internal "candidate list" of indexes that can be chosen to execute the query. If the index hint provided by the client is on the candidate list, then the optimizer will use it. Otherwise, the hint will be ignored. The optimizer will still try to honor index hints for other tables.