Cratylus
Cratylus

Reputation: 54074

Index on Composite attributes

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?

Upvotes: 2

Views: 374

Answers (1)

georgecj11
georgecj11

Reputation: 1637

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

Upvotes: 1

Related Questions