您好,欢迎访问一九零五行业门户网

Mysql数据库存储引擎

简单介绍存储引擎就是指表的类型。数据库的存储引擎决定了表在计算机中的存储方式。存储引擎的概念是mysql的特点,而且是一个插入式的存储引擎概念。这就决定了m
简单介绍
存储引擎就是指表的类型。数据库的存储引擎决定了表在计算机中的存储方式。存储引擎的概念是mysql的特点,而且是一个插入式的存储引擎概念。这就决定了mysql数据库中的表可以使用不同的存储方式存储。用户可以根据自己的不同要求,选择不同的存储方式、是否进行事务处理等。
查询方式及内容解析
使用show engines语句可以查看mysql数据库支持的存储引擎类型。查询方法如下:
show engines;show engunes语句可以使用“;”结束,也可以使用“\g”或者“\g”结束。“\g”与“;”的作用相同,“\g”可以让结果显示的更加美观。
mysql> show engines\g*************************** 1. row ***************************engine: mrg_myisamsupport: yescomment: collection of identical myisam tablestransactions: noxa: no savepoints: no*************************** 2. row ***************************engine: innodbsupport: defaultcomment: supports transactions, row-level locking, and foreign keystransactions: yesxa: yes savepoints: yes*************************** 3. row ***************************engine: myisamsupport: yescomment: myisam storage enginetransactions: noxa: no savepoints: no###############中间已省略###################*************************** 8. row ***************************engine: memorysupport: yescomment: hash based, stored in memory, useful for temporary tablestransactions: noxa: no savepoints: no8 rows in set (0.11 sec) 解析:查询结果中,engine参数指存储引擎名称;support参数说明mysql是否支持该类引擎,yes表示支持;comment参数指对该引擎的评论;transactions 参数表示是否支持事务处理,yes表示支持;xa参数表示是否分布式交易处理xa规范,yes表示支持;savepoints参数表示是否支持保存点,以便事务回滚到保存点,yes表示支持。
从查询结果中可以看出,mysql支持的引擎参数包括myisam、memory、innodb、archive和mrg_myisam等。其中innodb为默认的存储引擎。可使用语句查询默认的存储引擎此代码如下:
show variables like 'storage_engine'; 代码执行的结果如下:
mysql> show variables like 'storage_engine';+----------------+--------+| variable_name | value |+----------------+--------+| storage_engine | innodb |+----------------+--------+1 row in set (0.10 sec) 解析:结果显示默认的存储引擎为innodb。如果想修改默认的存储引擎可以在配置文件my.ini中修改。将”default-storage-engine=innodb”更改为”default-storage-engine=myisam”。然后重启服务,修改生效。
使用show tablestatus可以查看某个库中所有表支持的存储引擎类型查询方法如下:
mysql> use hellodbdatabase changedmysql> show table status\g*************************** 7. row ***************************name: tocengine: myisamversion: 10row_format: fixedrows: 0 avg_row_length: 0data_length: 0max_data_length: 2533274790395903 index_length: 1024data_free: 0 auto_increment: 1create_time: 2013-08-12 16:17:23update_time: 2013-08-12 16:17:23check_time: nullcollation: utf8_general_cichecksum: null create_options:comment:
个人建议:
存储日志或按时间增长的数据:myisam、archive
论坛应用:innodb
电商订单:innodb
数据量大:infobright、nosql、sphinx
个人总结,,希望对博友们有用!!
本文出自 “起点梦想” 博客,请务必保留此出处
其它类似信息

推荐信息