Subject Forced Plans ?
Author dry250
Hi,

First, i am using FireBird 1.5.2 on Windows XP.

I am optimizing my SQL queries, by searching the best plan for the
slowest queries.
I am meeting a little problem when I run this query :

SELECT
SUM(PVT.PAYVENTE_MNT_MNT)

FROM TBL_CREDIT CRE
JOIN TBL_PAYER_VENTE PVT ON (PVT.PAYVENTE_NUM_VENTE_PK =
CRE.CRED_NUM_VENTE_PK)

WHERE
(CRE.CRED_NUM_CREDITEUR_FK = 1) AND
(CRE.CRED_BOL_TRAITE = UDF_FALSE()) AND
(CRE.CRED_CDE_RAPPEL IS NULL) AND
(PVT.PAYVENTE_NUM_TYPPAIE_PK = 4)

PLAN JOIN (
CRE INDEX (FK_CREDIT_CLIENT, IDX_CREDIT_TRAITE,
IDX_CREDIT_RAPPEL),
PVT INDEX (FK_PAYERVENTE_VENTE)
)



What ever the order of "FK_CREDIT_CLIENT, IDX_CREDIT_TRAITE,
IDX_CREDIT_RAPPEL" in my forced plan, Firebird always takes this plan :

PLAN JOIN (
CRE INDEX
(IDX_CREDIT_RAPPEL,FK_CREDIT_CLIENT,IDX_CREDIT_TRAITE),
PVT INDEX (FK_PAYERVENTE_VENTE)
)

(Same result if I don't specify any plan and if I change the order of
conditions in the WHERE clause : always the same plan used)

I know my plan is better than fireBird's plan and I would like to
force fireBird to use mine.
Is there an solution ?