Mysql
How is Primary Key added to the index for InnoDB:
http://www.penglixun.com/tech/database/will_innodb_store_pk_in_index.html
1. Add ONLY the missing primary key column to the end of the index
eg.
pk (a, b)
key1 (c, a) => key1(c, a, b)
key2 (b, c) => key2(b, c, a)
2. Query does not know the key existence of index (c, a, b), (b, c, a), so the wrong index may be choosen.
沒有留言:
發佈留言