mysql column type selection

1, the priority field type

整型>data,time>char,varchar>blob

Integer, time fast operation, space-saving

char, varchar to consider the conversion and sorting proof sets character set, slow

Blob can not use temporary tables memory

 

2, do not use too much memory

Large field waste of memory, affect the speed

Such as: varchar (10), the same varchar (300) storing content, but joint investigation Table, varchar (300) to use more memory

 

3, try to avoid using null

null is not conducive to the index, use a special byte to mark

Take up more memory on disk

 

4, Enum Column Description

1, enum is an integer column inside to store

2, enum enum columns and columns of the fastest-related

3, enum associated with char, need to be transformed, to spend more time

4, when the very long char, enum is still a fixed-length integer, the greater the amount of data when queried, the more obvious advantages enum

5, enum associated with char / varchar, due to the conversion speed than enum - enum, char - char slower

But in particularly large amount of data, you can save IO

 

Guess you like

Origin www.cnblogs.com/WQLLL/p/11497487.html