Default index used by sql query on Sql broker

Posted by Ezaz War on 05-Apr-2017 08:58

Hi All,

What is the default index used by a query written in sql and executed on progress database

Regards,

Ezaz

All Replies

Posted by ChUIMonster on 05-Apr-2017 10:22

SQL uses a cost based optimizer.  Have you ever run UPDATE STATISTICS for this db?

This kbase is a good starting point:  knowledgebase.progress.com/.../20992

Or enter "update statistics" in the search box at:  knowledgebase.progress.com/pkb_Home

Posted by Dileep Dasa on 10-Apr-2017 05:30

If there are no indexes on a table, then SQL uses default index which is on ROWID. If there are multiple indexes defined on the table, then as [mention:dc2ff39fa15940708b78017f1194db6a:e9ed411860ed4f2ba0265705b8793d05] said, SQL uses a cost based optimizer to select the best index.

From SQL Development guide:

"Selecting an index

When the list of candidate index predicates has been determined, the optimizer selects which, if any, it will use for an index scan operation.

This selection is cost-based. The optimizer computes the cost for each of the index candidates and the cost for a table scan using the default index. The candidate with the lowest cost is chosen."

Posted by gus bjorklund on 11-Apr-2017 21:29

the query analyzer does not have a concept of “default index”. in the absence of other choices, it may use a table scan which does not use an index at all or it may use the so-called "primary index" if one exists.

This thread is closed