Little experience sharing-database

Use of char and varchar

  1. If the length of the data to be stored in the column is almost the same, you should consider using char; otherwise, you should consider using varchar.
    For example: ID number, order number, phone number.
  2. If the maximum data length in the column is less than 50Byte, generally consider using char.
    (Of course, if this column is rarely used, based on the consideration of saving space and reducing I/O, you can still choose to use varchar)
  3. Generally, it is not appropriate to define a char type column larger than 50Byte.

Comparison of MyISAM and InnoDB

Comparison item MyISAM InnoDB
Primary foreign key not support stand by
Affairs not support stand by
Row table lock Table lock, even if one record is operated, the entire table will be locked, which is not suitable for high concurrency Row lock, during operation, only one row is locked without affecting other rows, suitable for high concurrency
Cache Only cache indexes, not real data Not only caches indexes, but also caches real data, which requires high memory, and memory size has a decisive impact on performance
Table space small Big
focus point performance Affairs
Default installation Yes Yes

Guess you like

Origin blog.csdn.net/u013866352/article/details/107912316