MySQL: integer index versus Varchar index

Is there a performance issue with the data type of the index field?

Is an integer index much faster than a varchar index?

+6
source share
1 answer

The Integer index is faster than the varchar index, because an integer takes up less space in the database than varchar. Therefore, it is much faster to find an integer than to find a varchar string, because caching an integer index requires less memory. The smaller the data type, the more records can fit into index blocks. The more records that fit into each index block, the fewer records are required to search for records.

+9
source

Source: https://habr.com/ru/post/975394/


All Articles