复合属性索引 [英] Index on Composite attributes

查看:62
本文介绍了复合属性索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们在属性上创建索引时,会为此属性创建一棵树.
但是,当我们创建具有复合属性的索引时会发生什么呢?创建了两棵树?两者都是同一棵树的一部分吗?什么?

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?

推荐答案

它以与您提到的顺序相同的顺序连接属性.出于同样的原因,如果您以相同的顺序在a,b,c列上有一个复合索引,则只有在搜索到左列时该索引才有用

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

这篇关于复合属性索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆