Some common MySQL indexes and Profiling tips,
1. view the index of a table
Mysql> show indexes from [tablename] \ G Table: album Non_unique: 0 Key_name: PRIMARY Seq_in_index: 1 Column_name: album_id Collation: A Cardinality: 29 Sub_part: NULL Packed: NULL Null: index_type: BTREE Comment: 2, forced Index
Mysql> select * from [tablename] force index ([indexname]) where [xxxx] 3. Create an index
Mysql> create index [index_name] on [tablename] ([index]); 4. delete an index
Mysql> drop index [index_name] on [tablename]; The quality of indexes directly affects the execution performance of the MySQL database. You can check the indexes by using the Explain and Profiling tools.
Profiling is used as follows:
Mysql> set profiling = 1; mysql> select * from [tablename] mysql> show profiles; mysql> show profile [cpu, block] io for query [xx]; master the execution of profiling checks for MySQL.