Subject Re: [firebird-support] Joins, left joins, and plans
Author Dmitry Yemanov
"Rick Debay"" <rdebay@...> wrote in message:
>
> SELECT
> *
> FROM
> A JOIN A2B ON A.ID = A2B.A
> JOIN B ON B.ID = A2B.B
> LEFT JOIN B2C ON B.ID = B2C.B
> LEFT JOIN C ON C.ID = B2C.C
>
> PLAN JOIN (JOIN (JOIN (B NATURAL,A2B INDEX (FK_A2B_B),A INDEX
> (PK_A)),B2C INDEX (FK_B2C_B)),C INDEX (PK_C))

Same here.

> SELECT
> *
> FROM
> A JOIN A2B ON A.ID = A2B.A
> JOIN B ON B.ID = A2B.B
> LEFT JOIN (
> B2C JOIN C ON C.ID = B2C.C
> ) ON B.ID = B2C.B
>
> PLAN JOIN (JOIN (B NATURAL,A2B INDEX (FK_A2B_B),A INDEX (PK_A)),JOIN (C
> NATURAL,B2C INDEX (PK_B2C)))

PLAN JOIN (JOIN (B NATURAL, A2B INDEX (FK_A2B_B), A INDEX (PK_A)),
JOIN (B2C INDEX (FK_B2C_B), C INDEX (PK_C)))

Tested with v2.0. So you're correct, just the v1.5 optimizer is not so good
to follow your thinking :-)


Dmitry