|Subject||Re: [firebird-support] Re: Composite index - issue or not existing feature?|
14.03.2016 10:32, liviuslivius wrote:
> simple table
> CREATE TABLE XXX(
> A INTEGER
> , B INTEGER
> , CONSTRAINT UK_XXX__A__B UNIQUE(A, B)
> SELECT * FROM dbo.XXX X WHERE X.A BETWEEN 2 AND 30 *AND* X.B BETWEEN 5
> AND 60
> Select Expression
> -> Filter
> -> Table "XXX" as "X" Access By ID
> -> Bitmap
> -> Index "UK_XXX__A__B" Range Scan (lower bound: *1/2*,
> upper bound: *1/2*)
> As you can see only A key is used but B key should be also used.
> I am missing something?
Yes, you do. If the first segment is matched for non-equality, then the
following segments cannot be used.
Hi Dmitry,Why?Index is a Tree? And if i found VALUE 2 in A key then i can fast find value 5 in sub key (leaf)You scan throught keys in A, and then in finded nodes you look for leafs in Breagards,Karol Bieniaszewski