zoukankan      html  css  js  c++  java
  • 主流存储引擎详解:Innodb,Tokudb、Memory、MYISAM、Federated

    主流存储引擎:

      Innodb:推荐使用,主力引擎,使用99%以上的场景

      Tokudb:高速写入使用,日用量大量写入eg:500G可压缩为50G。适用于访问日志的写入,相对MYISAM有事务性,相对于INnodb有很好的压缩性。

      Inforbbright/InFiniDB,OLAP环境:劣势的存储引擎,主要运用在OLAP场景中,InFiniDB社区版可以支持队形计算。  

      Memory:根据需要使用,速度快,不支持并发  

      Federated:跨网络使用的一个引擎(默认不激活)

      Ndbcluster:mysql Cluster的引擎,可以将指定表存放到磁盘上。

      MYISAM:建议放弃,不支持事务。内存只能最多使用到4G,单核,一个CPU

    1、查看系统默认的存储引擎(mysql5.5之前默认存储引擎是MYISAM,5.5之后默认为Innodb。如果修改默认存储引擎,可以在参数default_storage_engine )

    mysql> show variables like '%storage_engine%';
    +----------------------------+--------+
    | Variable_name              | Value  |
    +----------------------------+--------+
    | default_storage_engine     | InnoDB |
    | default_tmp_storage_engine | InnoDB |
    | storage_engine             | InnoDB |
    +----------------------------+--------+
    3 rows in set (0.00 sec)

     2、查看当前数据库支持的存储引擎:(show engins )

    mysql> show engines;
    +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    | Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
    +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    | PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
    | CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
    | MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
    | BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
    | MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
    | MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
    | ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
    | FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
    | InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
    +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    9 rows in set (0.00 sec)

    3、修改已经创建好表的存储引擎:(alter table t_name engine=engines;)

    mysql> show create table t1G;
    *************************** 1. row ***************************
    Table: t1
    Create Table: CREATE TABLE `t1` (
    `id` int(11) DEFAULT NULL,
    `name` varchar(20) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1
    1 row in set (0.00 sec)
    
    ERROR: 
    No query specified
    
    mysql> alter table t1 engine=MyISAM;
    Query OK, 1 row affected (0.12 sec)
    Records: 1 Duplicates: 0 Warnings: 0
    
    mysql> show create table t1G;
    *************************** 1. row ***************************
    Table: t1
    Create Table: CREATE TABLE `t1` (
    `id` int(11) DEFAULT NULL,
    `name` varchar(20) DEFAULT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1
    1 row in set (0.00 sec)
    
    ERROR: 
    No query specified
  • 相关阅读:
    企业级应用架构(二)三层架构之数据访问层的封装与抽象
    企业级应用架构(一) 三层架构之解耦
    AngularJS-01.AngularJS,Module,Controller,scope
    ASP.NET-A low-level Look at the ASP.NE
    批量Insert
    C#连接Oracle数据库的方法
    List 集合 一行4个排序
    asp.net 14
    Linux 定时任务的配置
    Windows 修改域用户账户密码
  • 原文地址:https://www.cnblogs.com/1021lynn/p/5284079.html
Copyright © 2011-2022 走看看