Subject | Select - bad performance Help on Indexes |
---|---|
Author | radevojvodic |
Post date | 2005-02-01T11:43:44Z |
Hi all,
Ihave a select statement that looks like this. Can someone help me
on configuring indexes (and PLAN statement) to boost performance.
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
Thanks in advance
Ihave a select statement that looks like this. Can someone help me
on configuring indexes (and PLAN statement) to boost performance.
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
Thanks in advance