Subject (RESULTS) Re: How to improve select performance
Author IB/FB List
Hi people,

Thanks for the answers, here are the results I got running your suggestions:

My statment:
PLAN JOIN (MO INDEX (RDB$FOREIGN209),T INDEX (RDB$PRIMARY206,SK_TURNO_DATA))
Reads 254
Writes 21
Execution Time 9.09 sec

Alexander Nevsky:

select
min(T.Data)
from
Turno T join
MaquinaOcupacao MO on MO.TurnoID = T.TurnoID
and T.Data > '2002-12-01' and
MO.MaquinaID = 17

you suggestion gives me the same plan and execution time

PLAN JOIN (MO INDEX (RDB$FOREIGN209),T INDEX (RDB$PRIMARY206,SK_TURNO_DATA))
Reads 254
Writes 17
Execution time varing from 8.02 to 10.3 sec



Tomislav Avramovic:

select
min(T.Data)
from
Turno T LEFT join
MaquinaOcupacao MO on (MO.TurnoID = T.TurnoID)
where
T.Data > '2002-12-01' and
MO.MaquinaID = 17

PLAN JOIN (T INDEX (SK_TURNO_DATA),MO INDEX (RDB$FOREIGN210))
Reads 422
writes 31
Execution Time 1.0035 sec
GOOD RESULTS !!!

Daniel Rail:

select
min(Turno.Data)
from
Turno
where
(Turno.Data > '2002-12-01') and
exists (select
*
from
MaquinaOcupacao
where
(MaquinaOcupacao.MaquinaID=17) and
(MaquinaOcupacao.TurnoID=Turno.TurnoID)
)

PLAN (MAQUINAOCUPACAO INDEX (RDB$FOREIGN209,RDB$FOREIGN210))
PLAN (TURNO ORDER SK_TURNO_DATA)
Reads 259
writes 23
Execution Time 0.0010 sec
INSTANT REPONSE YEAH!!!!!

Thanks for everybody for the help !

Just one thing, before I run the statment from Tomislav I thought that the
speed will not be so good because of the left join, I am a little impressed
that a left join produces better results than a natural join... Any comments ?

thanks again !

Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br

At 19:34 26/11/2002 +0000, you wrote:
>--- In ib-support@y..., IB/FB List <iblist@t...> wrote:
>
> Alexandre, will
>
>select
> min(T.Data)
> from
> Turno T join
> MaquinaOcupacao MO on MO.TurnoID = T.TurnoID
> and T.Data > '2002-12-01' and
> MO.MaquinaID = 17
>
>be better?
>
>Best regards, Alexander V.Nevsky.
>
>
>
>To unsubscribe from this group, send an email to:
>ib-support-unsubscribe@egroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/