MySQL

Add an index to a mysql table

Create an index to a mysql table. Say there is a product_id column:

CREATE UNIQUE INDEX product_id
on table_name (product_id);

Add to existing table

mysql> alter table tablename add index product_id on product_id;