Skip to content

Cross join ignores user-specified plans [CORE2873] #3257

Open
@firebird-automations

Description

@firebird-automations

Submitted by: @dyemanov

Consider this trivial query:

select *
from rdb$relations r
join rdb$relation_fields rf on 1 = 1

Possible plans are:

PLAN JOIN (R NATURAL, RF NATURAL)
and
PLAN JOIN (RF NATURAL, R NATURAL)

but the engine silently ignores any user-specified plan always defaulting to the join order {A -> B} where cardinality(A) < cardinality(B). This isn't always the best choice, however.