Storage Engine
Database Storage Engine (How the data is stored and how the transaction is affected ) types of storage and manipulation tables
There is only one storage engine in Oracle and SQL , andMySQL has a variety of storage engines, Users can write their own storage engine according to their needs.
Viewing the storage engine
Show Engines\g
Show variables like ' have% ' ;
Show variables like ' storage_engine% ' ;
The default is InnoDB, which supports transactions, row-level locks, etc.
Select the storage engine
When creating a table, select
Create Table INNODB1 (
Id int
) Engine=innodb;
another kind of vi/etc/my.cnf
Default-storage-engine=innodb
Myisam(transaction not supported, very old storage engine, and foreign key not supported)5.5 before default storage engine
Innodb (most commonly used)5.5 after the default storage engine
Memory(fastest access, insecure, suitable for fast access or temporary tables, put in RAM)
Database Data Type
in the MySQL database management system, the type of table can be determined by the storage engine, and MySQL also provides the type of data type that determines the table's storage data .
Data type:
integer type int smallint bigint tinyint store user age, game level, and so on after the bracket width is not constrained
floating-point type float double stores user weight, height, salary, and so on the back of the bracket width will have a binding effect
fixed-point number types DEC Precision is higher than the floating point number because he stores it as a string value (m,d) This range refers to
bit type BIT
character type char varchar store user name, home address, hobby, published articles etc.
Text type text
Date type dates ,datetime,year Storage User Registration time, article release time, login time, entry time, etc.
enum- type enum- single-choice such as gender
Set type set multiple selection, such as hobby
To optimize storage, you should use the most accurate type in any case, so that it consumes the smallest amount of storage disk memory
This article is from "Happy Learning" blog, please be sure to keep this source http://983865387.blog.51cto.com/9838888/1917414
MySQL storage engine and data type