开发者

Query on one of attributes of composite key in database

A composite key contains two columns: col1, and col2. If I run a query on only col1, will the index be used? and why

I guess not, because typically index is implemented as开发者_如何学Go B+ tree. And in B+ tree, keys are stored in interior blocks and all records are stored at the lowest level of the tree. It may be not efficient or impossible if we do the query from the index.


In general, databases are capable of using the leading column(s) of a composite index. Whether or not the index actualy will be used, is up to the database optimizer to decide.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜