1. 程式人生 > >MySQL(三) —— MySQL效能優化之 索引優化

MySQL(三) —— MySQL效能優化之 索引優化

MySQL索引優化

  如何檢視mysql資料庫的引擎

一般情況下,mysql會預設提供多種儲存引擎,你可以通過下面的檢視: 看mysql支援哪些儲存引擎:

mysql> show engines;

mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)

看你的mysql當前預設的儲存引擎: mysql> show variables like '%storage_engine%'; 你要看某個表用了什麼引擎(在顯示結果裡引數engine後面的就表示該表當前用的儲存引擎): mysql> show create table 表名;

mysql> show engines; 看mysql當前預設的儲存引擎:

二、索引優化