表类型(存储引擎)的选择
来源:互联网 发布:dnf卡史诗软件 编辑:程序博客网 时间:2024/05/16 14:58
存储引擎:用户可以根据应用的需要选择如何存储和索引数据,是否使用事务等。存储引擎包括:myisam ,innodb ,bdb ,memory ,merge ,example ,ndb cluster , archive, csv,blackhole ,federated等,其中innodb和dbd提供事务安全,其他存储引擎都是非事务安全表。
查看当前的存储引擎:
mysql> show create table t8;+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Table | Create Table |+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| t8 | CREATE TABLE `t8` ( `id` int(11) NOT NULL, `name` varchar(45) DEFAULT NULL, `age` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 |+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+1 row in set (0.00 sec)
查看当前数据库支持的存储引擎
方法一,
mysql> show engines \g+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+| Engine | Support | Comment | Transactions | XA | Savepoints |+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+| CSV | YES | CSV storage engine | NO | NO | NO || 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 || PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO || InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES || ARCHIVE | YES | Archive storage engine | NO | NO | NO || MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO || FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+9 rows in set (0.00 sec)
方法二,
mysql> show variables like 'have%';+------------------------+----------+| Variable_name | Value |+------------------------+----------+| have_compress | YES || have_crypt | YES || have_dynamic_loading | YES || have_geometry | YES || have_openssl | DISABLED || have_profiling | YES || have_query_cache | YES || have_rtree_keys | YES || have_ssl | DISABLED || have_statement_timeout | YES || have_symlink | YES |+------------------------+----------+11 rows in set (0.01 sec)
在创建表的时候,可以通过增加engine关键字来设置新建表的存储引擎:
mysql> create table t9(id bigint(20) primary key,name varchar(63))engine=innodb default charset=gbk;mysql> show create table t9;+-------+---------------------------------------------------------------------------------------------------------------------------------------------+| Table | Create Table |+-------+---------------------------------------------------------------------------------------------------------------------------------------------+| t9 | CREATE TABLE `t9` ( `id` bigint(20) NOT NULL, `name` varchar(63) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=gbk |+-------+---------------------------------------------------------------------------------------------------------------------------------------------+1 row in set (0.00 sec)
修改表的存储引擎:
mysql> alter table t9 engine=myisam;Query OK, 0 rows affected (0.47 sec)Records: 0 Duplicates: 0 Warnings: 0mysql> show create table t9;+-------+---------------------------------------------------------------------------------------------------------------------------------------------+| Table | Create Table |+-------+---------------------------------------------------------------------------------------------------------------------------------------------+| t9 | CREATE TABLE `t9` ( `id` bigint(20) NOT NULL, `name` varchar(63) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=gbk |+-------+---------------------------------------------------------------------------------------------------------------------------------------------+1 row in set (0.00 sec)
二, 各种存储引擎的特性
在平时我们最常用的4种存储引擎有:
0 0
- 表类型(存储引擎)的选择
- 7 表类型(存储引擎)的选择
- 表类型,存储引擎的选择
- mysql存储引擎类型及存储引擎的选择
- Mysql学习笔记二, 表类型(存储引擎)的选择
- MySQL的表类型的(存储引擎)的选择MyISAM+InnoDB+MEMORY+MERGE
- MySQL学习笔记(五)--表类型(存储引擎)的选择
- mysql 学习之二 表类型(存储引擎)的选择
- MySql的存储引擎(表类型)
- 存储引擎的选择
- 选择引擎的类型
- MySQL存储引擎--存储引擎的选择
- 浅谈MySql的存储引擎(表类型)
- 浅谈MySql的存储引擎(表类型)
- 浅谈MySql的存储引擎(表类型)
- 浅谈MySql的存储引擎(表类型)
- 浅谈MySql的存储引擎(表类型)
- 浅谈MySql的存储引擎(表类型)
- verilog入门经验(四) 经验总结
- mycat全局序列号
- 微信小程序 (应用号)开发(教程)文档,内附开发工具及工具使用方法
- 欧洲央行德拉吉说低利率未来必然获得高利率
- python 将文字转为图片Logo
- 表类型(存储引擎)的选择
- Java中Calendar类的简单使用方法,以及日期格式化的方法,字符串日期格式的验证
- 虚拟机配置密匙
- PsychoPy入门_06_数据记录
- python挑战之level 23
- hxy系列2-图像分类与KNN
- Adobe 官方公布的 RTMP 规范
- 搭建 AngularJS+Ionic+Cordova 开发环境并运行一个demo
- 论文笔记《Fully Convolutional Networks for Semantic Segmentation》