Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check a SQL Server CE database for indexes?

Is there a way to list all SQL Server CE database table indexes, or at least for individual tables?

like image 247
Konstantinos Avatar asked Mar 06 '09 15:03

Konstantinos


People also ask

How do I find the indexes on a SQL Server database?

sp_helpindex is a system stored procedure which lists the information of all the indexes on a table or view. This is the easiest method to find the indexes in a table. sp_helpindex returns the name of the index, description of the index and the name of the column on which the index was created.

How do I know if my database is indexed?

To see the index for a specific table use SHOW INDEX: SHOW INDEX FROM yourtable; To see indexes for all tables within a specific schema you can use the STATISTICS table from INFORMATION_SCHEMA: SELECT DISTINCT TABLE_NAME, INDEX_NAME FROM INFORMATION_SCHEMA.

How do you check if indexes are being used in SQL?

Discoverying the use of the indexes We need to discover which are the queries using these indexes. In order to do that, we can query the SQL Server Plan Cache, analysing the XML of each query plan and find where the indexes are being used. The DMV sys.


2 Answers

Thank you Arjuna! you pointed me in the right direction..... The following works.

SELECT 'Y' FROM INFORMATION_SCHEMA.INDEXES
where table_name = 'PP_JOB_TICKET_LIVE'

and index_name = 'PP_JOB_TICKET_LIVE_PK'

Thanks so much for your time.

like image 34
user497858 Avatar answered Oct 12 '22 07:10

user497858


-- Retrieves information about the indexes contained in the database. SELECT * FROM INFORMATION_SCHEMA.INDEXES

-- Retrieves all the Tables in the database including the System tables. SELECT * FROM INFORMATION_SCHEMA.TABLES

Arjuna Chiththananda - Retrieving Schema Information of SQL CE Database

like image 187
Maksym Gontar Avatar answered Oct 12 '22 08:10

Maksym Gontar