Subject Rif: Re: Rif: [firebird-support] Re: Is it possible to use only "part" of the index?
Author Raffaele Confalone
and 'exactly this way because you do not know the value of ID_MASTER then
want all ID_MASTER without have index based on ID_PARAM. hello


-------Messaggio originale-------

Da: Mark Rotteveel mark@... [firebird-support]
Data: 20/07/2015 15.57.13
A: firebird-support@yahoogroups.com
Oggetto: Re: Rif: [firebird-support] Re: Is it possible to use only "part"
of the index?


On 20 Jul 2015 05:20:31 -0700, "brucedickinson@... [firebird-support]"
<firebird-support@yahoogroups.com> wrote:
> So, if I change the order of fields in the index I can speed things up.
> Could someone explain me why it works like it works? What are the
internals
> behind this?

Simplified the index entry is

<value of ID_MASTER><value of ID_PARAM>

This means that when you only want to find ID_PARAM, then the index cannot
be used, because Firebird would have to scan the whole index. If you
reverse the order of the fields, you get

<value of ID_PARAM><value of ID_MASTER>

This means that it can quickly identify the fields with ID_PARAM (a prefix
match on the entire index entry).

Mark




[Non-text portions of this message have been removed]