Friday, 22 April 2016

How to create and delete a table index ?


Need of a table index
If you have a huge data in the table and you know that some columns that will be used often as a search criteria, you can add index for that columns to improve the search performance.


Create a Table Index
CREATE INDEX idx_tip_subject ON tip(subject);

Get a List of Indexes of an existing table
SHOW INDEX FROM <tableName>
SHOW INDEX FROM tip;

Delete an Existing Index
DROP INDEX <indexName> ON <tableName>
DROP INDEX tip_subject ON tip;

No comments:

Post a Comment

Note: only a member of this blog may post a comment.