запрос:
SELECT DISTINCT *
FROM (SELECT i.NAME, 'р/с: ' || bank.account || CHR (13) || i.commentary AS RS , i.ident AS ID, doc.createdat,
s.supplierdoc || CHR (13) || s.ID AS num, doc.totalsum,
(SELECT SUM (spvat.taxsum)
FROM supermag.svspecvatwi spvat
WHERE spvat.doctype = doc.doctype
AND spvat.docid = doc.ID) AS nds,
CASE
WHEN s.paymentdelay = 0
THEN sup.paymentdelay
WHEN s.paymentdelay <> 0
THEN s.paymentdelay
END AS d
FROM SMClientBanks bank,
smwaybillsin s,
smdocuments doc,
smclientinfo i,
smsuppliers sup
WHERE bank.idclient(+) = i.id
AND s.ID = doc.ID
AND doc.clientindex = i.ID
AND doc.doctype = 'WI'
AND doc.docstate = 3
AND sup.ID = i.ID
AND bank.isactual = 1
order by i.ident
)
WHERE createdat + d BETWEEN TO_DATE ('20101004', 'YYYYMMDD')
AND TO_DATE ('20101007', 'YYYYMMDD')
AND d <> 0
загружает ЦП процессом oracle.exe на 50% и выполняется не менее 20 минут, посоветуйте, что изменить в нем, чтобы увеличить производительность