Pawan
Pawan

Reputation: 32321

How can i see index present in mysql

  1. I have created a index on my table this way

    CREATE UNIQUE INDEX  viid_in_item_topping  ON item_topping (item_id)
    
  2. I am checking indexes on that table this way

    SHOW INDEXES FROM item_topping;
    

It displayed output as

viid_in_item_topping

How can i see this particualr index ??

(Means on what field i created index)

I have tried using show viid_in_item_topping , desc viid_in_item_topping but nothing worked .

Could you please let me know how to see the index by its name ??

This question is not the same as posted in the link , how can i see the index by its name

Upvotes: 1

Views: 81

Answers (1)

winmutt
winmutt

Reputation: 405

You can do this by either SHOW CREATE TABLE or looking in INFORMATION_SCEHMA:

SHOW CREATE TABLE item_topping;

or

SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME='item_topping'

The former is usually easier to read.

Upvotes: 1

Related Questions