How I can find the list of Indexes for a given database in Sybase?
You can use the (index index_name clause in select, update, and delete statements to specify the index to use for a query. You can also force a query to perform a table scan by specifying the table name.
Sybase ASE offers two types of indexes: clustered and non-clustered. Clustered indexes physically sort table data to match their logical order. Non-clustered indexes only order the table data logically.
A Sybase clustered index is an index which physically orders the actual data in the table. Therefore, the clustered index is the fastest index and only one is allowed for each table. A nonclustered index does not order the actual rows of the table.
Query against sysobjects and sysindexes:
SELECT o.name,
i.name
FROM sysobjects o
JOIN sysindexes i
ON (o.id = i.id)
Documentation on the interpretation of the sysobjects and sysindexes system tables is available on the Sybase web-site.
Load up stored procedure library from http://www.edbarlow.com/ and type in sp__helpindex
or use the Sybase-provided sp_helpindex which expects the table-name as a parameter.
SELECT Object_name(id)
FROM sysindexes si
WHERE indid > 0
To get a complete list of indexes in Sybase ASE we can use the following query -
select si.* from sysobjects so, sysindexes si where so.id = si.id and si.indid > 0
keepin in mind that a simple select between sysobjects system table and the sysindexes table will give table names along with index names if non-clustered indexes exists. Check the following link for more information -
Sybase ASE - How to find index list in a sybase database
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With