Fetch First n Rows Only

Fetch First n Rows Only

 

  

hi gurus

Is query 1 more expensive?

1. select * from TABLE1 order by COL1 desc, COL2 FETCH FIRST n ROWS ONLY

2. select * from TABLE1 FETCH FIRST n ROWS ONLY

Let's say COL1 is not indexed, does it mean DB2 will do a whole table scan
and sort the results only to return the first "n" rows?

Cheers
Ray

DB2 & UDB email list listserv db2-l LazyDBA home page