Subject Re: [firebird-support] Using NATURAL plan instead of index - why?
Author Thomas Steinmaurer
> Hi,
>
> This is really weird.
>
> I cannot see why a NATURAL plan is being used instead of my index, I am not doing anything fancy.
>
> Using: FB2.5.1 32 bit classic server
>
> Query:
>
> select t.SalesOrderNo from stk_stocktransaction t
> where (t.SourceType = 34)
> and (t.TransactionType = 'EXTCST')
> and (t.RefNo = 'I00001')
>
> Plan is:
> PLAN (T NATURAL)
>
> Yet I have the following index: SourceType, TransactionType, RefNo asc
>
> With selectivity: 0.0000049....
>
> Table has 1.4 million records.
>
> Query does 1.4 million non-indexed reads, and takes 11 to 20 seconds to return no records (for the parameters I have selected)
>
> My development database DOES use the index.
>
> Please help! Is this a bug, or am I missing something!
>
> How can I force it to use the index, to see if it is any faster?

Is the index by any chance inactive, e.g. due to a restore without
indexes etc ...


--
With regards,
Thomas Steinmaurer
http://www.upscene.com/