Subject | Re: Query Optimization |
---|---|
Author | jjochoa75 |
Post date | 2004-10-20T15:32:28Z |
Hi,
PLAN JOIN (A INDEX (RDB$FOREIGN132),B INDEX (RDB$FOREIGN112))
Adapted plan:
PLAN JOIN (A INDEX
(FK_INSPECT_GROUP_LOT_DESTFK_INSPECT_GROUP$FOREIGN112))
Yes that was the problem with "inner join"! Now is as fast as LEFT
JOIN!
How can I expand this same query to join another table (FK) from A
or B and visit it ONLY 237 times?????
An IN Clause sounds great but doesn't work! :(
Thanks
Juan Jose.
> Change your query toIDX_TB_INSPECT_STATUS
>
> SELECT B.TB_INSPECT_ID
> FROM TB_INSPECT_GROUP A inner JOIN TB_INSPECT B
> ON (B.INSPECTION_GROUP_ID = A.TB_INSPECT_GROUP_ID)
> WHERE A.DEST_LOT_ID IS NULL
> AND A.SO_DET_ID IS NOT NULL
> AND (B.WRITE_UP_DET_ID IS NULL
> AND B.STATUS IN ('PASSED','USE AS IS') OR 2=0)
>
> This should prevent IDX_TB_INSPECT_WUP_DET and
> from being used with this query.PLAN JOIN (A INDEX (RDB$FOREIGN132),B INDEX (RDB$FOREIGN112)):
>
PLAN JOIN (A INDEX (RDB$FOREIGN132),B INDEX (RDB$FOREIGN112))
Adapted plan:
PLAN JOIN (A INDEX
(FK_INSPECT_GROUP_LOT_DESTFK_INSPECT_GROUP$FOREIGN112))
Yes that was the problem with "inner join"! Now is as fast as LEFT
JOIN!
>joins
> I think your issue largely is due to the assumption that left
> are better than inner joins combined with the creation of too manyNow, the big issue, the original one!
> indexes.
How can I expand this same query to join another table (FK) from A
or B and visit it ONLY 237 times?????
An IN Clause sounds great but doesn't work! :(
Thanks
Juan Jose.