Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)
How can I check if my database has any indexes on it?

How about a particular table?

1 Answer

0 votes
by (12.7k points)

To check the index for a specific table you have to use "SHOW INDEX":

SHOW INDEX FROM yourtable;

To see indexes for all the tables within a particular schema you can use the STATISTICS table from INFORMATION_SCHEMA:

SELECT DISTINCT
    TABLE_NAME,
    INDEX_NAME
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = 'your_schema';

Deleting the where clause will show you all the indexes in all schemas.

Kick-start your career in SQL with the perfect SQL Course by Intellipaat now!

Related questions

0 votes
1 answer
asked Dec 16, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Jan 6, 2021 in SQL by Appu (6.1k points)
+2 votes
1 answer

Browse Categories

...