Subject | Re: [firebird-support] Re: Understanding a PLAN |
---|---|
Author | Jaume Llunell Gómez |
Post date | 2014-08-30T10:39:51Z |
Thank you very much Dimitry
2014-08-30 10:41 GMT+02:00 Dmitry Yemanov dimitr@... [firebird-support] <firebird-support@yahoogroups.com>:
First, index scan for TABLE1_UK is performed to create a bitmap of30.08.2014 11:25, Jaume Llunell Gómez wrote:
> Hi, i would like to understand this plan
>
> PLAN (TABLE1 ORDER TABLE1_IDX1 INDEX (TABLE1_UK))
>
> And the select that generets it is this one:
>
> SELECT first 1 PREU_COST
> FROM TABLE1
> WHERE ARTICLE = :p_article
> AND DATA <= :P_DATA
> AND DIVISA = :P_DIVISA
> AND PREU_COST >0
> ORDER BY DATA DESC,ID DESC
>
> So my question is, does this plan first goes to TABLE1_IDX1 to resolve
> the order by or first uses TABLE1_UK to resolve the where?
records matching the WHERE clause.
Then, index TABLE1_IDX1 is traversed sequentially in the index order
(aka full index scan) and every record ID found there is checked against
the bitmap. If match is found, then record is returned.
Dmitry