Дольше всего висит этот insert, собственно где-то с 13:00 и висит
INSERT INTO ttremains
(storeloc, article, quantity)
(SELECT location, article, -sum(quantity) quantity
FROM (SELECT l.id location, s.article, sum(s.quantity * decode(l.id,
d.locationto, 1, d.locationfrom, -1, 0)) quantity
FROM smdocuments d, smstorelocations l, smspec s
WHERE d.doctype = s.doctype
AND d.id = s.docid
AND l.id IN (d.locationto, d.locationfrom)
AND l.id IN (1, 2, 4, 5, 6, 10, 11, 12, 13, 15, 16, 17, 19,
20, 21, 24, 25, 27, 29, 30, 31, 33, 34, 38, 40, 41,
47, 48, 55, 57, 58, 60, 61, 62, 63, 64, 65, 66, 67,
68, 69, 70, 72, 73, 74, 75, 76, 77)
AND d.docstate >= 2
AND d.createdat > to_date('28.01.2008', 'DD.MM.YYYY')
AND s.article IN (SELECT fdata
FROM ttfilterstr
WHERE ftype = 1)
GROUP BY l.id, s.article
HAVING sum(s.quantity * decode(l.id, d.locationto, 1,
d.locationfrom, -1, 0)) <> 0
UNION ALL
SELECT storeloc, article, -quantity
FROM smgoods
WHERE quantity <> 0
AND storeloc IN (1, 2, 4, 5, 6, 10, 11, 12, 13, 15, 16, 17,
19, 20, 21, 24, 25, 27, 29, 30, 31, 33, 34, 38, 40,
41, 47, 48, 55, 57, 58, 60, 61, 62, 63, 64, 65, 66,
67, 68, 69, 70, 72, 73, 74, 75, 76, 77)
AND article IN (SELECT fdata
FROM ttfilterstr
WHERE ftype = 1))
GROUP BY location, article
HAVING sum(quantity) <> 0)