Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to choose the appropriate storage engine in MySQL

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to choose the appropriate storage engine in MySQL. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

MySQL has a variety of storage engines:

MyISAM, InnoDB, MERGE, MEMORY (HEAP), BDB (BerkeleyDB), EXAMPLE, FEDERATED, ARCHIVE, CSV, BLACKHOLE.

MySQL supports several storage engines as processors for different types of tables. The MySQL storage engine includes an engine that processes transactional security tables and an engine that processes non-transactional security tables:

◆ MyISAM manages non-transactional tables. It provides high-speed storage and retrieval, as well as full-text search capabilities. MyISAM is supported in all MySQL configurations and is the default storage engine unless you configure MySQL to use another engine by default.

The ◆ MEMORY storage engine provides in-memory tables. The MERGE storage engine allows collections to process the same MyISAM table as a separate table. Just like MyISAM, the MEMORY and MERGE storage engines handle non-transactional tables, and both engines are included in MySQL by default.

Note: the MEMORY storage engine is officially identified as the HEAP engine.

The ◆ InnoDB and BDB storage engines provide transaction security tables. BDB is included in the MySQL-Max binary distribution released for the operating system that supports it. InnoDB is also included by default in all MySQL 5.1 binary distributions, and you can configure MySQL to allow or disable any engine as you like.

The ◆ EXAMPLE storage engine is a "stub" engine that does nothing. You can use this engine to create tables, but no data is stored or retrieved from it. The purpose of this engine is to serve as an example in the MySQL source code that demonstrates how to start writing a new storage engine. Again, its main interest is for developers.

◆ NDB Cluster is a storage engine used by MySQL Cluster to implement tables split into multiple computers. It is available in the MySQL-Max 5.1 binary distribution. This storage engine is currently only supported by, Solaris, and Mac OS X. In future MySQL distributions, we want to add support for this engine on other platforms, including Windows.

The ◆ ARCHIVE storage engine is used to cover large amounts of stored data indexed and very small.

The ◆ CSV storage engine stores data in a text file in a comma-delimited format.

The ◆ BLACKHOLE storage engine accepts but does not store data, and retrieval always returns an empty set.

The ◆ FEDERATED storage engine stores data remotely. In MySQL 5.1, it only works with MySQL and uses MySQL C Client API. In future distributions, we want it to connect to another data source using a different drive or client connection method.

When you create a new table, you can tell MySQL what type of table you want to create by adding an ENGINE or TYPE option to the CREATE TABLE statement:

CREATE TABLE t (I INT) ENGINE = INNODB

CREATE TABLE t (I INT) TYPE = MEMORY

Although TYPE is still supported in MySQL 5.1, ENGINE is now the preferred term.

How to choose the storage engine that works best for you?

The following storage engines are the most commonly used:

◆ MyISAM: the default MySQL plug-in storage engine, which is one of the most commonly used storage engines in Web, data warehousing, and other application environments. Note that you can easily change the default storage engine of the MySQL server by changing the STORAGE_ENGINE configuration variable.

◆ InnoDB: for transactional applications, with many features, including ACID transaction support.

◆ BDB: a transaction engine that replaces InnoDB and supports COMMIT, ROLLBACK, and other transaction features.

◆ Memory: saves all data in RAM, providing extremely fast access in environments where references and other similar data need to be found quickly.

◆ Merge: allows MySQL DBA or developers to logically group a series of equivalent MyISAM tables together and reference them as one object. Ideal for VLDB environments such as data warehousing.

◆ Archive: provides the perfect solution for the storage and retrieval of a large number of rarely referenced historical, archiving, or security audit information.

◆ Federated: the ability to link multiple separate MySQL servers to create a logical database from multiple physical servers. Ideal for distributed or data Mart environments.

◆ Cluster/NDB:MySQL 's clustered database engine is especially suitable for applications with high-performance lookup requirements, which also require the highest uptime and availability.

◆ Other: other storage engines include CSV, which refers to files used as database tables separated by commas, Blackhole, which temporarily suppresses application input to the database, and the Example engine, which helps to quickly create custom plug-in storage engines.

Keep in mind that you don't have to use the same storage engine for the entire server or scenario, and it's important that you use a different storage engine for each table in the scenario.

> show engines

+-- +

| | Engine | Support | Comment | |

+-- +

| | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance |

| | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | |

| | InnoDB | YES | Supports transactions, row-level locking, and foreign keys | |

| | BerkeleyDB | NO | Supports transactions and page-level locking | |

| | BLACKHOLE | NO | / dev/null storage engine (anything you write to it disappears) | |

| | EXAMPLE | NO | Example storage engine | |

| | ARCHIVE | NO | Archive storage engine | |

| | CSV | NO | CSV storage engine | |

| | ndbcluster | NO | Clustered, fault-tolerant, memory-based tables | |

| | FEDERATED | NO | Federated MySQL storage engine | |

| | MRG_MYISAM | YES | Collection of identical MyISAM tables | |

| | ISAM | NO | Obsolete storage engine | |

+-- +

The above is how to choose the appropriate storage engine in the MySQL shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report