Search code examples
mysqlindexinginnodbb-treeb-plus-tree

How many B/B+ tree will be created if I add a multi column index?


In mysql with InnoDB storage engine, When create a multi column index, such as (a, b, c), how many B+ tree/B tree will be create?

Explain the detail if you can.


Solution

  • InnoDB creates B+trees only. There is one tree for PRIMARY index. For every secondary index InnoDB creates one B+tee no matter how many columns are in the key.

    See my slides with more examples https://twindb.com/efficient-use-of-indexes-in-mysql/