Using Indexes : Index « Table « MySQL Tutorial






An index is a structured file that facilitates data access.

Indexes speed up data access for SELECT queries, but they slow it down for INSERT, UPDATE, and DELETE queries.

Indexes also work better on columns that contain unique data.

One index can be made up of one or more columns.

You can also have more than one index in a table.









4.19.Index
4.19.1.Using Indexes
4.19.2.Creating an Index
4.19.3.Creating an Index with the ALTER TABLE Statement
4.19.4.CREATE INDEX index_name ON table_name (column_name[,...]);
4.19.5.Using the ALTER TABLE statement to add an index
4.19.6.Deleting Indexes
4.19.7.ALTER TABLE table_name ADD (KEY|INDEX) index_name (column_name[,...]);
4.19.8.ALTER TABLE Employee ADD (KEY) myIndex (id);
4.19.9.Alter table to add an index on two columns
4.19.10.SHOW INDEX FROM Employee;
4.19.11.CREATE UNIQUE INDEX [index_name] ON table_name (column_name[,...]);
4.19.12.ALTER TABLE Employee DROP INDEX lastn_idx;