Subject | Re: [firebird-support] Query performance with PLAN |
---|---|
Author | Dmitry Yemanov |
Post date | 2007-07-25T16:33:54Z |
psantosl wrote:
A3_FIDREVISION?
upgraded (ODS11) one? Is your index statistics up-to-date?
mr.fidmarker + 0 = 3358447
Dmitry
>What's the difference between indices MKRREAL_FIDREVISION and
> SELECT
> ci.iobjid, ci.fiditem, ci.fidrevision,
> ci.sname, ci.fitemfsprotection
> FROM
> A1 r, A2 mr, A3 ci
> WHERE
> r.iobjid = mr.fidrevision AND
> ci.fidrevision = r.iobjid AND
> mr.fidmarker = 3358447
>
> Table A1 has about 50K registers
> Table A2 about 250K (but only 3 fields, integers)
> Table A3 has about 90K registers
>
> A3 is indexed by the field fidrevision.
A3_FIDREVISION?
> The proposed plan made by firebird (1.5, but the same is havingDid you try v2.0 against the same (ODS10) database or against an
> problems with 2.0) is:
upgraded (ODS11) one? Is your index statistics up-to-date?
> PLAN JOIN (CI NATURAL,R INDEX (PK_REVISION),MR INDEXIndex MKRREAL_FIDMARKER looks unnecessary here.
> (MKRREAL_FIDREVISION,MKRREAL_FIDMARKER))
> The problem is that each time I try to specify an index in the PLANYou don't show us how do you write the plan with a new index.
> I get the following error
>
> index A3_FIDREVISION cannot be used in the specified plan
> If I change to the following planAn easier workaround would be:
>
> PLAN JOIN(MR NATURAL, R INDEX(PK_REVISION), CI INDEX
> (A3_FIDREVISION) )
mr.fidmarker + 0 = 3358447
> The query executes in 400ms!!!Not a surprise at all.
> But my question is: shouldn't be Firebird able to do it itself??Yes it should.
Dmitry