MySQL--架构与索引

1 MYSQL架构
MySQL--架构与索引_第1张图片
2 存储引擎
2.1 常用命令
2.1.1 查看数据库引擎- show engines;
MySQL--架构与索引_第2张图片
2.1.2 查看当前默认的引擎-- show variables like ‘%storage_engine%’;
MySQL--架构与索引_第3张图片
2.2 InnoDB与MyIsAm比较
MyIsAm对事务不支持,InnoDB支持
MyIsAm即使操作一行数据也会锁住整个表,InnoDb行锁操作时只锁住一行,不对其他行有影响。
MyIsAm关注性能,InnoDB关注事务

查看冗余索引
SELECT
	a.TABLE_SCHEMA AS ‘数据名’,
	a.table_name AS ‘表名’,
	a.index_name AS ‘索引1’,
	b.INDEX_NAME AS ‘索引2’,a.COLUMN_NAME AS ‘重复列名’
FROM
	STATISTICS a
JOIN STATISTICS b ON a.TABLE_SCHEMA = b.TABLE_SCHEMA
AND a.TABLE_NAME = b.table_NAME
AND a.SEQ_IN_INDEX = b.SEQ_IN_INDEX
AND a.COLUMN_NAME = b.COLUMN_NAME
WHERE
	a.SEQ_IN_INDEX = 1
AND a.INDEX_NAME <> b.INDEX_NAME

你可能感兴趣的:(数据库)