During a routine performance check using an event monitor, I
discovered a class of query whose performance has me baffled.
The monitor captured:
SELECT * FROM EWM_CASE fetch first 1 rows only
It took 14 seconds of CPU time to execute. After looking up the
documentation on the FETCH FIRST notation I find "Limiting the result
table to the first integer rows can improve performance. The database
manager will cease
processing the query once it has determined the first integer rows."
I did some validation tests. From UNIX command line, I issued:
db2 -x "SELECT * FROM EWM_CASE fetch first 1 rows only"
and
db2 -x "SELECT * FROM EWM_CASE"|head -1
I got the same row back in both cases but times were drastically
different (13.86 secs vs. .002 sec).
When asked to explain this behavior, I was at a loss. Any clues from
the group?
(AIX 4.3, DB2 7.2 FP11)
Thanks,
Evan
discovered a class of query whose performance has me baffled.
The monitor captured:
SELECT * FROM EWM_CASE fetch first 1 rows only
It took 14 seconds of CPU time to execute. After looking up the
documentation on the FETCH FIRST notation I find "Limiting the result
table to the first integer rows can improve performance. The database
manager will cease
processing the query once it has determined the first integer rows."
I did some validation tests. From UNIX command line, I issued:
db2 -x "SELECT * FROM EWM_CASE fetch first 1 rows only"
and
db2 -x "SELECT * FROM EWM_CASE"|head -1
I got the same row back in both cases but times were drastically
different (13.86 secs vs. .002 sec).
When asked to explain this behavior, I was at a loss. Any clues from
the group?
(AIX 4.3, DB2 7.2 FP11)
Thanks,
Evan
Comment