首页 MySql mysql –The MEMORY Storage Engine–官方文档

mysql –The MEMORY Storage Engine–官方文档

原文地址:http://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.htmlTheMEMORYstorage engine (formerly known asHEAP) creates special-purpose tables with contents that are stored in memory. Because the data is vulnerable to crashes, ha

原文地址:http://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.html

Thestorage engine (formerly known as) creates special-purpose tables with contents that are stored in memory. Because the data is vulnerable to crashes,hardware issues,or power outages,only use these tables as temporary work areas or read-only caches for data pulled from other tables.

Table15.4Storage Engine Features

Implemented in the server (via encryption functions),rather than in the storage engine.

Implemented in the server,rather than in the storage engine.

Implemented in the server,rather than in the storage engine.

When to Use MEMORY or MySQL Cluster.Developers looking to deploy applications that use thestorage engine for important,highly available,or frequently updated data should consider whether MySQL Cluster is a better choice. A typical use case for theengine involves these characteristics:

Operations involving transient,non-critical data such as session management or caching. When the MySQL server halts or restarts,the data intables is lost.

  • In-memory storage for fast access and low latency. Data volume can fit entirely in memory without causing the operating system to swap out virtual memory pages.

  • A read-only or read-mostly data access pattern (limited updates).

  • MySQL Cluster offers the same features as theengine with higher performance levels,and provides additional features not available with:

    Row-level locking and multiple-thread operation for low contention between clients.

  • Scalability even with statement mixes that include writes.

  • Optional disk-backed operation for data durability.

  • Shared-nothing architecture and multiple-host operation with no single point of failure,enabling 99.999% availability.

  • Automatic data distribution across nodes; application developers need not craft custom sharding or partitioning solutions.

  • Support for variable-length data types (includingand) not supported by.

  • For a white paper with more detailed comparison of thestorage engine and MySQL Cluster,see. This white paper includes a performance study of the two technologies and a step-by-step guide describing how existingusers can migrate to MySQL Cluster.

    Performance Characteristics

    performance is constrained by contention resulting from single-thread execution and table lock overhead when processing updates. This limits scalability when load increases,particularly for statement mixes that include writes.

    Despite the in-memory processing fortables,they are not necessarily faster thantables on a busy server,for general-purpose queries,or under a read/write workload. In particular,the table locking involved with performing updates can slow down concurrent usage oftables from multiple sessions.

    Depending on the kinds of queries performed on atable,you might create indexes as either the default hash data structure (for looking up single values based on a unique key),or a general-purpose B-tree data structure (for all kinds of queries involving equality,inequality,or range operators such as less than or greater than). The following sections illustrate the syntax for creating both kinds of indexes. A common performance issue is using the default hash indexes in workloads where B-tree indexes are more efficient.

    Physical Characteristics of MEMORY Tables

    Thestorage engine associates each table with one disk file,which stores the table definition (not the data). The file name begins with the table name and has an extension of.

    tables have the following characteristics:

    Space fortables is allocated in small blocks. Tables use 100% dynamic hashing for inserts. No overflow area or extra key space is needed. No extra space is needed for free lists. Deleted rows are put in a linked list and are reused when you insert new data into the table.tables also have none of the problems commonly associated with deletes plus inserts in hashed tables.

  • tables use a fixed-length row-storage format. Variable-length types such asare stored using a fixed length.

  • tables cannot containorcolumns.

  • includes support forcolumns.

  • Non-tables are shared among all clients,just like any other non-table.

  • DDL Operations for MEMORY Tables

    To create atable,specify the clauseon thestatement.

    As indicated by the engine name,tables are stored in memory. They use hash indexes by default,which makes them very fast for single-value lookups,and very useful for creating temporary tables. However,when the server shuts down,all rows stored intables are lost. The tables themselves continue to exist because their definitions are stored infiles on disk,but they are empty when the server restarts.

    本文来自网络,不代表云浮站长网立场。转载请注明出处: https://www.0766zz.com/html/shujuku/mysql/20200901/8892.html
    上一篇
    下一篇

    作者: dawei

    【声明】:云浮站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

    为您推荐

    【免责声明】本站内容转载自互联网,其发布内容言论不代表本站观点,如果其链接、内容的侵犯您的权益,烦请提交相关链接至邮箱xwei067@foxmail.com我们将及时予以处理。

    Copygight © 2017-2023 https://www.0766zz.com All Rights Reserved.云浮站长网

    站长:xwei067#foxmail.com(请把#换成@)