MySQL存储引擎
来源:互联网 发布:eclipse中文是乱码 mac 编辑:程序博客网 时间:2024/06/07 01:18
MySQL事物自动提交
mysql> show variables like '%auto%' ;+-----------------------------+-------+| Variable_name | Value |+-----------------------------+-------+| auto_increment_increment | 1 || auto_increment_offset | 1 || autocommit | ON || automatic_sp_privileges | ON || innodb_autoextend_increment | 8 || innodb_autoinc_lock_mode | 1 || sql_auto_is_null | OFF |+-----------------------------+-------+7 rows in set (0.00 sec)mysql> set autocommit=1;Query OK, 0 rows affected (0.00 sec)mysql> show variables like '%auto%';+-----------------------------+-------+| Variable_name | Value |+-----------------------------+-------+| auto_increment_increment | 1 || auto_increment_offset | 1 || autocommit | ON || automatic_sp_privileges | ON || innodb_autoextend_increment | 8 || innodb_autoinc_lock_mode | 1 || sql_auto_is_null | OFF |+-----------------------------+-------+7 rows in set (0.00 sec)mysql> set autocommit=0;Query OK, 0 rows affected (0.00 sec)mysql> show variables like '%auto%';+-----------------------------+-------+| Variable_name | Value |+-----------------------------+-------+| auto_increment_increment | 1 || auto_increment_offset | 1 || autocommit | OFF || automatic_sp_privileges | ON || innodb_autoextend_increment | 8 || innodb_autoinc_lock_mode | 1 || sql_auto_is_null | OFF |+-----------------------------+-------+rollback; 回滚事物commit; 提交事物
MySQL常用存储引擎:MyISAM 和 InnoDB(特性ACID)
mysql> show engines;+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+| Engine | Support | Comment | Transactions | XA | Savepoints |+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO || FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO || CSV | YES | CSV storage engine | NO | NO | NO || BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO || MyISAM | YES | MyISAM storage engine | NO | NO | NO || MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO || InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES || PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+8 rows in set (0.00 sec)
MyISAM引擎调优
1、设置合适的索引。
2、调整读写优先级,根据实际需求确保重要操作优先执行。
3、启用延迟插入改善大批量写入性能。
4、尽量顺序操作让insert数据都能写入尾部,减少阻塞。
5、分解大的时间长的操作,降低单个操作的阻塞时间。
6、降低并发数。
7、对于更改不频繁的数据,利用Query Cache缓存服务缓存数据。
InnoDB引擎调优
1、主键尽可能小。
2、避免全表扫描。
3、尽可能缓存索引和数据,减小IO。
4、尽可能自己控制事物而不使用自动提交。
5、合理设置 innodb_flush_log_at_trx_commit 参数。0:性能最好 | 1:安全最高 | 2:类似Oracle
6、避免主键更新,因为这样会带来大量数据移动。
--分表,一个表一个数据文件。mysql> show variables like '%innodb_file_per_table%';+-----------------------+-------+| Variable_name | Value |+-----------------------+-------+| innodb_file_per_table | ON |+-----------------------+-------+1 row in set (0.00 sec)
批量修改MySQL引擎
1、ALTER TABLE t1 ENGINE = InnoDB ALTER TABLE t1 ENGINE = MyISAM2、nohup sed -e 's/MyISAM/InnoDB/g' backup.sql > backup_new.sql &3、/application/mysql/bin/mysql_convert_table_format
0 0
- 【MySQL】MySQL存储引擎
- 【MySQL】MySQL存储引擎
- mysql federated存储引擎引擎
- MySQL的存储引擎
- 1.5. MySQL存储引擎
- mysql存储引擎
- MySQL 存储引擎
- MySQL存储引擎
- Mysql的存储引擎
- MySQL存储引擎
- MySQL存储引擎-应用
- mysql存储引擎
- MySQL存储引擎认知
- MySQL存储引擎选择
- mysql archive存储引擎
- MySQL存储引擎
- Mysql数据库存储引擎
- mysql存储引擎比较
- opencv for android (环境搭建篇)
- 【小松教你手游开发】【面试必读(编程基础)】转载一篇优秀的c#泛型理解
- Android手机存储器分类
- MFC的图片控件的使用(图片适应控件大小并不失真)
- sqlmap 使用测试初级教程(实际已测试 -版本1.0)
- MySQL存储引擎
- 自定义卫星菜单CustomArcMenu
- css之菜单制作
- ViewPageIndecator使用
- Android notification的使用
- 系统从很老的V12.4.X升级到V15.0.4中个别报表构建中出现的错误及解决办法
- 【iOS】OC-时间转化的时区问题
- 修改Sql Server列属性时报错
- JS 报错 “Uncaught SyntaxError: Unexpected token o”