MySQL Training Summary 博客分类: 经验总结 mysql
程序员文章站
2024-02-20 21:28:46
...
Store Engine
In a database, different tables can use different store engines.
Configuration
Storage
Partitioning (Horizon)
MySQL 5.5 has build-in partitioning function.
Range Partitioning:
HASH Partitioning:
In a database, different tables can use different store engines.
- MyISAM Not Support: Transaction, Row level locking
- InnoDB (Default store engine from MySQL 5.5) Not Support: Full-text index
Support: Full-text index
So MyISAM is good at big amount data query.
Support: Transaction, Row level locking
InnoDB is good at DML operations (Delete, insert, update). For most of cases, use InnoDB is better choice.
Configuration
- show variables : Display static parameters
- show status : Display dynamic parameters
Storage
- MySQL data default location is /usr/local/mysql/data. Use an other partition store data. To avoid the disk operation competition.
- *.myd is MyISAM data file. *.myi is MyISAM index file.
- Data, index and log files should not store in the root partition, since the performance reason.
- Store data files and index files separately. (InnoDB cannot do that)
Partitioning (Horizon)
MySQL 5.5 has build-in partitioning function.
Range Partitioning:
CREATE TABLE employees ( id INT NOT NULL, fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', separated DATE NOT NULL DEFAULT '9999-12-31', job_code INT NOT NULL, store_id INT NOT NULL ) PARTITION BY RANGE (job_code) ( PARTITION p0 VALUES LESS THAN (100), PARTITION p1 VALUES LESS THAN (1000), PARTITION p2 VALUES LESS THAN (10000) );
HASH Partitioning:
CREATE TABLE ti (id INT, amount DECIMAL(7,2), tr_date DATE) ENGINE=INNODB PARTITION BY HASH( MONTH(tr_date) ) PARTITIONS 6;
下一篇: list的4种遍历方式(实例讲解)
推荐阅读
-
MySQL LIKE 子句 博客分类: 数据库 MySQLLIKEPHP
-
Mysql忘记密码恢复 博客分类: DataBase mysql 忘记 密码 恢复 解决 办法
-
MySQL复制 博客分类: 高性能MySQL读书笔记 mysql复制
-
mysql复制表结构或者表数据,可备份数据 博客分类: mysql 乔乐共享mysql表结构复制备份
-
(转)MySQL多字节字符集造成主从数据不一致问题 博客分类: mysql MySQL主从preparestatement乱码
-
SQL语句的执行顺序 博客分类: mysql sqlgroup byhaving
-
mysql负载,查询优化,索引和锁等 博客分类: 总结-2014
-
Linux中安装MySQL 博客分类: MySQLLinux linuxmysql
-
mysql负载,查询优化,索引和锁等 博客分类: 总结-2014
-
mysql分布式架构和DAL设计 博客分类: 分布式