zoukankan      html  css  js  c++  java
  • mysql 存储引擎 memory

    查看支持的引擎

    mysql> show engines;
    +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    | Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
    +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    | InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
    | MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | 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         |
    | MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
    | CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
    | ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
    | PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
    | FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
    +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
    9 rows in set (0.01 sec)
    
    

    Memory表被存储在内存中。且默认使用哈希索引。这使得它们很快,而且对创建暂时表很实用。但是。当server关闭之时,全部存储在Memory表里的数据被丢失。

    由于表的定义被存在磁盘上的.frm文件里,所以表自身继续存在。在server重新启动动时它们是空的。

    要明白指出你想要一个Memory表。可使用ENGINE选项来指定:

    CREATE TABLE t (i INT) ENGINE = MEMORY;
    
    CREATE TABLE test ENGINE=MEMORY;
    SELECT ip,SUM(downloads) AS down FROM log_table GROUP BY ip;
    SELECT COUNT(ip),AVG(down) FROM test;
    DROP TABLE test;
    
  • 相关阅读:
    在Linux下安装和使用MySQL
    vc动态装载动态库
    stl学习(转帖2)
    makefile
    详细的MySQL C API
    Excel INTO SQLSERVER
    Outlook2010中预览Word,Excel附件问题
    11gRAC ASM管理的数据文件丢失恢复
    ASM上控制文件损坏时的恢复
    使用NET USER增加一个超级管理 & 激活Windows 7 administrator
  • 原文地址:https://www.cnblogs.com/brady-wang/p/15116260.html
Copyright © 2011-2022 走看看