Subject RE: [firebird-support] Joins, left joins, and plans
Author Rick Debay
Good. I'll continue to use the correct join style, as the tables
involved aren't big enough for the two natural joins to be an issue yet.
Just don't let FB 2 slip too long :-)

-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Dmitry Yemanov
Sent: Tuesday, October 11, 2005 2:52 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Joins, left joins, and plans

"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



------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/67folB/TM
--------------------------------------------------------------------~->

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item on
the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Yahoo! Groups Links