mysql联合索引数据结构表现形式

形式一(先记录,暂时无法验证正确性 ==||| )

摘自:https://pdfs.semanticscholar.org/0d7b/8b9172a69fa069c9c38b5f01bd37a498563c.pdf

mysql联合索引数据结构表现形式

• A B+-Tree on a composite key indexes the key values as if the composite key was a single key.

• For example, in the B+-Tree above, (Bournemouth, 1000) is less than or equal to (Bournemouth, 1000) and so it appears in the first leaf node. However, (Bournemouth, 7500) is greater than (Bournemouth, 1000) and so it appears in the second leaf node.

• The order of the individual attributes in the composite key is important. The same as sorting a sentence of words alphabetically.

• “The ordering of the search-key values is the lexicographic ordering. For example, for the case of two attribute search keys, (a1,a2) < (b1,b2) if either a1 < b1, or a1 = b1 and a2 < b2.” [Silberschatz et al]

• For example, although the second value of (Armagh, 1500) is greater than the second value of (Bournemouth, 1000), the order of the attributes means that (Armagh, 1500) is less than (Bournemouth, 1000).

• Therefore, the above B+-Tree may be used to search for (branch_name) or (branch_name, balance) but not (balance). For example, balance=2000 appears in two paths of the B+-Tree.