dougcoulter
Programmer
Hello everyone. I am attempting to run a nested query against an Oracle 9i database and have been experiencing major performance issues. Here it is:
SELECT chars.lot, chars.char, chars.code,
(SELECT MIN(move.mdate) FROM fin.move move WHERE move.lot = chars.lot AND move.mdate > {ts '1991-01-26 00:00:00'}) AS madedate
FROM fin.chars chars
WHERE (chars.code BETWEEN '1215229' AND '1215229')
AND (chars.char BETWEEN 0.0001 AND 110)
ORDER BY madedate
My first issue is that it will not even compile with the ORDER BY clause as is - so I temporarily removed it. After which, it will compile, but it basically goes out to lunch. Based on my best guess, it should return no more than 1000 records.
To simplify it, I reduced the subquery's first WHERE clause to:
move.lot = 'xxxx'
where xxxx is a known lot number. This simplified query works, but it takes a good 30 seconds to execute.
Not having any access to the Oracle database hinders my ability to really troubleshoot this issue, so I was wondering if there is just something obviously inefficient about the query in its original form?
Any help would be greatly appreciated. Thanks.
SELECT chars.lot, chars.char, chars.code,
(SELECT MIN(move.mdate) FROM fin.move move WHERE move.lot = chars.lot AND move.mdate > {ts '1991-01-26 00:00:00'}) AS madedate
FROM fin.chars chars
WHERE (chars.code BETWEEN '1215229' AND '1215229')
AND (chars.char BETWEEN 0.0001 AND 110)
ORDER BY madedate
My first issue is that it will not even compile with the ORDER BY clause as is - so I temporarily removed it. After which, it will compile, but it basically goes out to lunch. Based on my best guess, it should return no more than 1000 records.
To simplify it, I reduced the subquery's first WHERE clause to:
move.lot = 'xxxx'
where xxxx is a known lot number. This simplified query works, but it takes a good 30 seconds to execute.
Not having any access to the Oracle database hinders my ability to really troubleshoot this issue, so I was wondering if there is just something obviously inefficient about the query in its original form?
Any help would be greatly appreciated. Thanks.