виснет на запросе:
Код:
SELECT --+ FIRST_ROWS
DH.ID as ID, DH.CreatedAt, CL.Name as ClientName, DH.LocationTo,
DH.OpCode as Operation, DH.UserOp, DH.TotalSum, DH.Debt as Payment,
DH.BaseDocTypeAndID, DH.DocState,
(select (select nvl(Sum(SPECV.TotalPrice), 0)
from Supermag.SVSpecWI SPECV
where SPECV.DocType = DH.DocType and SPECV.DocID = DH.ID)
-
(select nvl(Sum(SVAT.TaxSum), 0)
from Supermag.SVSpecVatWI SVAT
where SVAT.DocType = DH.DocType and SVAT.DocID = DH.ID and SVAT.TaxRate > 0)
from Dual) as TotalSumNoVat,
(select nvl(Sum(SVAT10.TaxSum), 0)
from Supermag.SVSpecVatWI SVAT10
where SVAT10.DocType = DH.DocType
and SVAT10.DocID = DH.ID
and SVAT10.TaxRate = 10) as TotalSumVat10,
(select nvl(Sum(SVAT20.TaxSum), 0)
from Supermag.SVSpecVatWI SVAT20
where SVAT20.DocType = DH.DocType
and SVAT20.DocID = DH.ID
and SVAT20.TaxRate = 20) as TotalSumVat20, DH.SupplierDoc,
DH.SupplierInvoice, DH.PayCash, DH.GoodsOwner,
DH.ChildDocTypeAndID, DH.TotalSumCur as TotalSumCur,
DH.SupplDocSum,
(select FileName||' '||to_char(Amount) from Supermag.SVInsertedDocsWI DI
where DI.DocType = DH.DocType
and DI.ID = DH.ID and rownum = 1 ) as InsertedDocs,
DH.FinBaseDocTypeAndID,
(select nvl(sum(SPECV.TotalPriceNoTax), 0)
from Supermag.SVSpecWI SPECV, Supermag.SVSpecVatWI SVAT
where SPECV.DocType = DH.DocType and SPECV.DocID = DH.ID
and SVAT.DocType = SPECV.DocType and SVAT.DocID = SPECV.DocID
and SVAT.SpecItem = SPECV.SpecItem and SVAT.TaxRate=10) as TotalSumNoVat10,
(select nvl(sum(SPECV.TotalPriceNoTax), 0)
from Supermag.SVSpecWI SPECV, Supermag.SVSpecVatWI SVAT
where SPECV.DocType = DH.DocType and SPECV.DocID = DH.ID
and SVAT.DocType = SPECV.DocType and SVAT.DocID = SPECV.DocID
and SVAT.SpecItem = SPECV.SpecItem and SVAT.TaxRate=20) as TotalSumNoVat20,
DH.GrossWeight,
(select nvl(Sum(SVAT18.TaxSum), 0)
from Supermag.SVSpecVatWI SVAT18
where SVAT18.DocType = DH.DocType
and SVAT18.DocID = DH.ID and SVAT18.TaxRate = 18) as TotalSumVat18,
(select nvl(sum(SPECV.TotalPriceNoTax), 0)
from Supermag.SVSpecWI SPECV, Supermag.SVSpecVatWI SVAT
where SPECV.DocType = DH.DocType and SPECV.DocID = DH.ID
and SVAT.DocType = SPECV.DocType and SVAT.DocID = SPECV.DocID
and SVAT.SpecItem = SPECV.SpecItem and SVAT.TaxRate=18) as TotalSumNoVat18,
DH.SupplInvoiceCreate, DH.SupplInvoiceAccept, DH.TotalSumVat,
DH.TotalSumVat+DH.TotalSumSpec as TotalSumWithVat,
(Select ValStr from Supermag.SVDocLabels L where L.DocType=DH.DocType
and L.DocID=DH.ID and L.LabelID='Sys.RefuseWI') as Label__0
FROM SuperMag.SVDocumentsWI DH , SuperMag.SMClientInfo CL
WHERE DH.DocType = 'WI'
AND DH.CreatedAt = TO_DATE('20110728','YYYYMMDD')
AND (CL.ID(+)= DH.ClientIndex)
если из девелопера посмотреть сессию, то видно, что он чего то делает, но дождаться результата я не смог :(
сделал селекты с подсчетом количества по всем табличкам, которые используются в этом запросе, выполняет в секунды. А так висит :(
что еще можно посмотреть?