当前位置:网站首页>MySQL storage engine

MySQL storage engine

2022-07-07 03:36:00 Fire eye Dragon

Concept

Database storage engine is the bottom software organization of database , Database management system (DBMS) Create with data engine 、 Inquire about 、 Update and delete data .

  • Different storage engines provide different storage mechanisms 、 Indexing techniques 、 Lock level and other functions . Now many different database management systems support many different data engines .MySQL The core is the storage engine
  • Users can choose different storage engines for data tables according to different needs
  • have access to SHOW ENGINES command , You can see MySQL All execution engines of , We can see that the default execution engine is innoDB Support transactions , Row level locking and foreign keys .

classification

  • CSV: Logically, it is the storage engine of comma pink data . Special offer to create one for each data table in the database subdirectory .csv file . This is a normal text file , Each data line takes up one text line .CSV The storage engine does not support indexes .
  • BlackHole: Black hole engine , Any data written will disappear , Generally used to record binlog Do replication relay
  • ERFORMANCE_SCHEMA Storage engine : The engine is mainly used for mobile database server performance parameters .
  • Mrg_Myisam Merge Storage engine : It's a group. Mylsam The combination of , in other words , He will be Myisam Multiple table aggregation engines , But he has no internal data , The real data is still Myisam In the engine's table , But you can query directly 、 Delete, update, etc .
function MyISAMMEMORYInnoDB
Storage limits 256TBRAM64TB
Support transactions NoNoYes
Full text index support YesNoNo
Support B Tree index YesYesYes
Support hash index NoYesNo
Support cluster indexing NoNoYes
Support data indexing NoYesYes
Support data compression YesNoNo
Space support rate low N/A high
Support foreign keys NoNoYes

operation

Query the storage engine supported by the current database

Method :

SHOW ENGINES;

View the current default storage engine .

Method :

SHOW VARIABLES LIKE '%storage_engine%';

See what engine a table uses ( In the real results, the parameters engine The latter indicates the current storage engine )

Method :

SHOW CREATE TABLE table_name;

Specify the storage engine when creating a new table

Method :

CREATE TABLE(...) ENGINE = MYISAM;

Modify database engine

Method :

ALTER TABLE table_name ENGINE = MYISAM;
ALTER TABLE table_name ENGINE = InnoDB;

modify MySQL Default storage engine

  1. close MySQL service
  2. find MySQL In the service installation directory my.ini file
  3. find default-storage-engine=INNODB Change to target engine
  4. start-up MySQL service
原网站

版权声明
本文为[Fire eye Dragon]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207062027413383.html