Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can find the list of Sybase Indexes for a given database?

Tags:

indexing

isql

How I can find the list of Indexes for a given database in Sybase?

like image 689
aartist Avatar asked Sep 23 '09 19:09

aartist


People also ask

How do I see indexes 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.

What are type of indexes in Sybase database?

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.

What is index in Sybase?

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.


3 Answers

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.

like image 90
Paul Harrington Avatar answered Sep 26 '22 17:09

Paul Harrington


SELECT Object_name(id)
FROM   sysindexes si
WHERE  indid > 0  
like image 37
deepak11 Avatar answered Sep 22 '22 17:09

deepak11


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

like image 43
Abhinav Avatar answered Sep 23 '22 17:09

Abhinav