Subject RE: [firebird-support] natural in plan
Author PODESTA Mariano APRE
hi, i have a problem with a select.
fb1.5 superserver rc5 on win2k/winnt

with the 'left join' at last i get this plan:

select *
from hist_evento he
join cuenta c on c.id_cuenta = he.id_cuenta
left join zona z on z.id_zona = he.id_zona
where he.fecha_hora >= '2003-08-01'

PLAN JOIN (JOIN (C NATURAL,HE INDEX (IDX_HIST_EVENTO_FC)),Z INDEX (PK_ZONA))

indexes:
IDX_HIST_EVENTO_FC = ID_CUENTA, FECHA_HORA
PK_ZONA = ID_ZONA

but, with the 'left join' next to 'from', i get this:

select *
from hist_evento he
left join zona z on z.id_zona = he.id_zona
join cuenta c on c.id_cuenta = he.id_cuenta
where he.fecha_hora >= '2003-08-01'

PLAN JOIN (JOIN (HE INDEX (IDX_HIST_EVENTO_FH),Z INDEX (PK_ZONA)),C INDEX
(PK_CUENTA))

indexes:
IDX_HIST_EVENTO_FH = FECHA_HORA
PK_ZONA = ID_ZONA
PK_CUENTA = ID_CUENTA

i have this situation on many querys an it gets too slow.
the second way runs perfect but i don't know why.
can anyone explain me this?

thanks,
mariano