I am trying understand why Firebird 3 does not use an index in my simplified query below. If I run it without the plan clause it uses
PLAN JOIN (L NATURAL, T INDEX (FK_TRANS_LEDGER), P INDEX (IDX_PRODUCTIONS1))
If I explicitly add the plan with the index (as below) it throws an error saying I cannot use the index in the plan (The index is unique on ledgerkey)
SELECT P.prodname FROM TRANS t
join productions p on t.jobkey=p.prodkey
join ledger l on l.ledgerkey=t.lkey
PLAN JOIN (L INDEX (IDX_LEDGER4), T INDEX (FK_TRANS_LEDGER), P INDEX (IDX_PRODUCTIONS1))