Home > database >  Index is a little don't understand, experienced person to give directions
Index is a little don't understand, experienced person to give directions

Time:10-12

In the field of digital type index, such as: B tree index, index when loaded into memory can be sorted by rules in the B tree; If it is a character type index, in B how to sort the tree? (is the characters according to the acsi code conversion insert again?)

CodePudding user response:

Character is character the sort order, any characters can be converted to binary code,

CodePudding user response:

Various types has its collation, and character types of sorting and points all sorts of all sorts of character sets COLLATE
Is not a simple ascII ordering

CodePudding user response:

1. Mysql index sorting to the influence of the character set and collation,
2. The collation priority: SQL statement & gt; Column level set & gt; Table level set & gt; Library level set & gt; Instance level set, that is to say, in the SQL statement specifies the collation, with their group as a standard, otherwise the following level shall prevail (level), if the column level is not specified, the default is to inherit the table level Settings, and so on,
3. The character set utf8mb4, for example, we used the ordering rules are: utf8mb4_general_ci, utf8mb4_bin, utf8mb4_unicode_ci
4. Check the Mysql instance level character level, and ordering rules: show variables like '% % character; Show variables like collation % %


CodePudding user response:

reference generation princess reply: 3/f
1. Mysql index sorting to the influence of the character set and collation,
2. The collation priority: SQL statement & gt; Column level set & gt; Table level set & gt; Library level set & gt; Instance level set, that is to say, in the SQL statement specifies the collation, with their group as a standard, otherwise the following level shall prevail (level), if the column level is not specified, the default is to inherit the table level Settings, and so on,
3. The character set utf8mb4, for example, we used the ordering rules are: utf8mb4_general_ci, utf8mb4_bin, utf8mb4_unicode_ci
4. Check the Mysql instance level character level, and ordering rules: show variables like '% % character; Show variables like collation % %

See, there is a small problem in trouble: ordinary index duplicate key values in the B + tree is how order processing?

CodePudding user response:

According to the acsi code to insert again, do not need to be transformed

CodePudding user response:

I do programmers reference 4 floor response:
Quote: refer to the third floor, the generation of the princess's reply:
1. Mysql index sorting to the influence of the character set and collation,
2. The collation priority: SQL statement & gt; Column level set & gt; Table level set & gt; Library level set & gt; Instance level set, that is to say, in the SQL statement specifies the collation, with their group as a standard, otherwise the following level shall prevail (level), if the column level is not specified, the default is to inherit the table level Settings, and so on,
3. The character set utf8mb4, for example, we used the ordering rules are: utf8mb4_general_ci, utf8mb4_bin, utf8mb4_unicode_ci
4. Check the Mysql instance level character level, and ordering rules: show variables like '% % character; Show variables like collation % %

See, there is a small problem in trouble: ordinary index duplicate key values in the B + tree is how order processing?

In the form of a list together
  • Related