Three: table storage engine

A: Storage Engine

select  *  from  user

Although the contents of the table shows is like this,

FIG Mysql above is not stored in the form of a table,

Table has the table structure, table data, they are stored separately, are present in the form of a separate file, and index, and the index is a data storage put together, and there is no data storage put together

The default storage engine InnoDB, you can see the folder in the database indicate .frm file is stored in the table structure, indicating .ibd is innodb-data means data innodb storage engine is stored in this file inside

Many storage Mysql provided for Oracle only one.

show engines; View all supported storage engine, InnoDB is the default storage engine.

mysql5.6 supported storage engines, including InnoDB, MyISAM, MEMORY, CSV, BLACKHOLE, FEDERATED, MRG_MYISAM, ARCHIVE, PERFORMANCE_SCHEMA. Which NDB and InnoDB provides transaction-safe tables, other storage engines are non-transaction-safe tables.

Corresponding to different storage engines is different storage methods.

InnoDB supports transactions (consistency, atomicity, isolation,), foreign key, row-level locks (concurrent access to the peer data, plus a lock), a data structure, the two divided data files stored

memory is a memory database, restart disappeared, it has been replaced by redis

myisam a data structure, the data, the index file storing three divided

MySQL data in a variety of different technologies stored in the file (or memory) in the. Each of these technologies technology uses a different storage mechanism, indexing techniques, lock level and ultimately provide a wide range of different functions and capabilities. By choosing different techniques, you can get extra speed or functionality, thereby improving the overall functionality of your application.

II: Common Data Engine Detailed

InnoDB

For transaction processing applications, support for foreign keys, and row-level locking. If the application for completeness things have relatively high requirements, data requirements under concurrent conditions consistency, data insertion and query operations in addition, also it includes many updates and deletes, then the InnoDB storage engine is more appropriate. In addition to effectively reduce the InnoDB caused by the lock deletes and updates can also ensure the integrity of the transaction commit and rollback for similar billing system or financial system for data accuracy requirements are relatively high system suitable choice.

MyISAM

If the application is read and insert operations-based, only a few of update and delete operations, and the integrity of the transaction, concurrency do not ask, you can choose the storage engine.

Memory

All data stored in memory, in the need to quickly locate records and other similar data environment, providing fast access. Memory drawback is that there are restrictions on the size of the table, although the database because of an abnormal termination, then data can be restored to normal, but once the database is shut down, the data will be stored in memory loss.

Three: When you create a table of the specified storage engine

View Configuration

the Variables Show like " % Engine % " Look storage engines 
Show the Variables like " % Character % " to see the character encoding 
show create table user; see the construction of the table statement, including encoding and storage engine than desc user to see more

 Four : Mysql workflow

 

A total of four MySQL architecture, as the division in the above figure in dashed lines. 
  First, the top of MySQL service is not unique, giving most of the network client / server tools or services have a similar architecture. For example: connection handling, authorization and authentication, and security. 
  The second layer architecture includes most of MySQL's core services. Including: query parsing, analysis, optimization, caching, and all built-in functions (for example: date, time, math and encryption function). At the same time, all across storage engine functions are implemented in this layer: stored procedures, triggers, views, and so on.

  The third layer contains a storage engine. The storage engines in MySQL storage and retrieval of data. Server communicates through the API, and the storage engine. These interfaces shielding differences between storage engine, such that the differences of the upper transparent inquiry procedure. Storage Engine API may contain a dozen underlying function, for performing a "start transaction" and other operations. But generally not storage engine to parse SQL (InnoDB resolves foreign key definition, since it does not itself implement the function), not between different storage engines communicate with each other, but simply in response to the upper layer request to the server.

  The fourth layer includes the file system, all of the tables and data structures, and ultimately logs user operation in the form of files stored on the hard disk.

Guess you like

Origin www.cnblogs.com/gyxpy/p/11565327.html