Subject Re: [firebird-support] Compound indexes and plans
Author Dmitry Yemanov
<leugim@...> wrote:
>
> the query was:
> SELECT 1
> FROM TABLE_A
> WHERE COL_1 = ? AND COL_2 > 0 AND COL_3 = ?
>
> why not on col_3?

Because COL_2 is used for inequality comparison. A compound key is something
like a concatenated string. If you want to use its Nth segment, all previous
N-1 segments should be matched for equality. Otherwise it's impossible to
set up the starting point of the range scan.


Dmitry