Get the App
SLTechnology News&Howtos  ›  Database  › 

Master some knowledge of mysql storage engine and data types

Shulou Source: shulou.com Published: 2022-06-01 19:11:59 10月23日 Update

This article mainly introduces you to master some knowledge of mysql storage engine and data types, the contents of the article are carefully selected and edited by the author, with a certain pertinence, the reference significance for everyone is still relatively great, the following with the author to learn to master some knowledge of mysql storage engine and data types.

Storage engine

The database storage engine (which affects the way data is stored and transactions) stores and manipulates the types of tables

There is only one storage engine in oracle and sql. Mysql has a variety of storage engines. Users can write their own storage engines according to their own needs.

View Storage Engin

Show engines\ g

Show variables like 'have%'

Show variables like 'storage_engine%'

The default is innodb, which supports transactions, row-level locks, etc.

Select Storage engine

Select when creating the table

Create table innodb1 (

Id int

) engine=innodb

Another vi / etc/my.cnf

Default-storage-engine=innodb

Myisam (does not support transactions, an old storage engine, nor does it support foreign keys) the default storage engine before 5.5

Innodb (most commonly used) default storage engine after 5.5,

Memory (the fastest access, insecure, suitable for fast access or temporary tables, placed in memory)

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 data type to determine the type of data stored in the table.

Data type:

Integer type int smallint bigint tinyint stores the user's age, game level, etc., followed by the width of parentheses has no constraint.

Floating point type float double stores users' weight, height, salary, etc., followed by the width of parentheses.

Fixed-point type DEC is more accurate than floating-point numbers because the range it stores as string values refers to

Bit type BIT

Character type char varchar stores the user's name, home address, hobbies, published articles, etc.

Text type text

The date type date,datetime,year stores the user's registration time, post release time, login time, entry time, etc.

Enumerated type enum radio such as gender

Multiple set collection types, such as hobbies

To optimize storage, the most precise type should be used in all cases to minimize the amount of storage disk memory

After reading the above about mastering some knowledge of mysql storage engine and data types, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.

Tags: Type storage engine data user knowledge time transaction database article point support function memory character width parenthesis way author industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MariaDB MySQL Apple Shulou Tech Info