View previous topic :: View next topic |
Author |
Message |
jctgf Beginner
Joined: 05 Nov 2006 Posts: 89 Topics: 36
|
Posted: Sat Mar 07, 2009 6:07 pm Post subject: how is this query resolved? |
|
|
Code: |
SELECT ...
FROM TABLE1
WHERE COLUMNA = ...
AND COLUMNB < ...
ORDER BY COLUMNB
FETCH FIRST 200 ROWS ONLY
|
Hi there,
In this query I select lines from a table, order it and limit the result cursor to 250 lines.
I wonder if these steps are taken in the sequence described above, please.
If so, and if the number of lines selected in the first step is huge, it probably won |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Sun Mar 08, 2009 10:15 pm Post subject: |
|
|
If you have an index that matches the ORDER BY columns exactly, DB2 could bypass the physical sort. You'd have to look at the access path for the query to make sure. |
|
Back to top |
|
|
jctgf Beginner
Joined: 05 Nov 2006 Posts: 89 Topics: 36
|
Posted: Mon Mar 09, 2009 5:12 pm Post subject: |
|
|
thanks. |
|
Back to top |
|
|
|
|