Index on Composite attributes

瘦欲@ 提交于 2021-02-10 05:38:25

问题


When we create an index on an attribute a tree is created for this attribute.
But what happens when we create an index with composite attributes? Two trees are created? Both are part of the same tree? What?


回答1:


It concats the attributes in the same order as you have mentioned. It for the same reason, if you have an composite index on columns a,b,c in the same order, the index will be useful only if the left columns are searched

WHERE a=4 ## uses index
WHERE a=4 and b=10 ## uses index
WHERE b=10 ## doesnot use index


来源:https://stackoverflow.com/questions/15349110/index-on-composite-attributes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!