Subject AW: [firebird-support] Select - bad performance Help on Indexes
Author Alexander Gräf
> -----Ursprüngliche Nachricht-----
> Von: radevojvodic [mailto:vrade@...]
> Gesendet: Dienstag, 1. Februar 2005 12:44
> An: firebird-support@yahoogroups.com
> Betreff: [firebird-support] Select - bad performance Help on Indexes
>
> SELECT S1.MAG_ID, S1.ROBA_ID, MAX( S2.SDOK_DNROB ),
> S1.CIJENA, SUM( S2.KOR_ULAZ - S2.KOR_IZLAZ ),
> S1.SDOK_DNROB,
> R.roba_naziv
> FROM SDOK S1
> INNER JOIN SDOK S2 ON (S1.MAG_ID = S2.MAG_ID) AND
> (S1.ROBA_ID = S2.ROBA_ID)
> INNER JOIN ROBA R ON S2.ROBA_ID = R.ROBA_ID
> WHERE ( ( (S1.SDOK_DNROB > 0 ) and (S2.SDOK_DNROB > 0 ) ) and
> S1.mag_id = 11)
> GROUP BY S1.MAG_ID, S1.ROBA_ID, S1.SDOK_DNROB, S1.CIJENA,
> R.roba_naziv
> HAVING ( (S1.SDOK_DNROB = MAX(S2.SDOK_DNROB)) )
> Order By S1.MAG_ID, S1.ROBA_ID, S1.SDOK_DNROB
>

You should include the optimizers adapted plan, and information about what indices are there in your database.

Regards, Alex