Index forcing and data-only-locked tables

The choice of index to use for a query can be forced with index clause and an index name, as in this command:

select title_id, type, price
	from titles (index title_id_ix)

Adaptive Server accepts an index ID in place of the keyword index and the index name. The following statement forces the use of a clustered index on an allpages-locked table:

select title_id, type, price
	from titles (1)

When you convert a table with a clustered index to data-only locking, the index ID of the clustered index changes. If you execute a query that specifies index ID 1, the optimizer still uses the clustered index on the table. You should carefully check all query plans that force index ID 1.

NoteSybase strongly recommends the use of index names, rather than index IDs, for forcing index selection.