MySQL storage engine and data type

Source: Internet
Author: User
Tags float double

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.