Column Type Choices and Query Efficiency

This section provides some guidelines for choosing your columns that can help queries run more quickly:[2]

[2] In this discussion, "BLOB types" should be read as meaning both BLOB and TEXT types.

  • Use fixed-length columns rather than variable-length columns. This is especially true for tables that are modified often and therefore more subject to fragmentation. For example, make all character columns CHAR rather than VARCHAR. The tradeoff is that your table will use more space, but if you can afford the extra space, fixed-length rows can be processed more quickly than variable-length rows.

  • Don't use longer columns when shorter ones will do. If you are using fixed-length CHAR columns, don't make them unnecessarily ...

Get MySQL now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.