开发者

Effects of order of columns, while defining an index on them, on the performance of the queries

开发者 https://www.devze.com 2022-12-30 19:23 出处:网络
Does order of the columns in an Index definition for a table in a database has any effect on the performance?

Does order of the columns in an Index definition for a table in a database has any effect on the performance? for e.g. are these two queries different ? CREATE INDEX开发者_JS百科 xxx ON tablex(col1,col2) CREATE INDEX xxx ON tablex(col2,col1)

what about the in case that I use a BTREE index? I am using Mysql. thanks


Yes it does make a difference. An index on (col1, col2) can serve queries that only require an index on col1 but it cannot be used for queries that require only col2.

0

精彩评论

暂无评论...
验证码 换一张
取 消