MySQL Show Indexes

Profile picture for user arilio666

SHOW INDEXES is to query the table's index present in the database where it has been assigned some index constraints.

SHOW INDEXES FROM table_name;

The table name has to be specified to fetch the index information. FROM does this.

We can also fetch index information off of a table with a database name.

SHOW INDEXES FROM table_name 
IN database_name;

or

SHOW INDEXES FROM database_name.table_name;

Let us check if these works in real-time.

We have a rec table where the email and name columns are indexed with unique constraints.

show indexes in mysql

Let us check the index information in this table.

SHOW INDEXES FROM rec;  

mysql show indexes

We have primary, unique indexed to this table.

SHOW INDEXES FROM rec 
IN sakila;

The same action can be expected when used.

Tags