Hi all,

the JDBC driver does execute the FETCH command as a so-called MASS command.

Without going into the gory details - small result sets are so transported in
one message to the client, and unwanted rows are not transported to the client
(if the result set has 100000 rows, you are interested in the first 10 it makes
no sense to get all, even if they would fit in the message).

So it is not a 'dumb cut'.

Keep in mind that the execution time of the SQL statement is also important,
so look into the query plans how and whether indexes are used. It may be more
costly to execute the query and order a temporary result by a column than actually
transmitting the rows to a client. In that case it would be what you call a 'dumb cut',
but on server side.

Regards
Alexander Schr�der
SAP Labs Berlin

> -----Original Message-----
> From: Andrew Perepelytsya [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 04, 2003 12:17 AM
> To: [EMAIL PROTECTED]
> Subject: again ORDER BY and ROWNO
> 
> 
> Don't be afraid, it's not another query on 'how' ;) . I am 
> quite familiar
> with the limitations and workarounds for this issue.
> 
> I managed to solve this problem the following (Java/JDBC) 
> way, though I would
> like to hear if I'm missing any points here:
> 
> 1. we want to select, say, top 10 companies in our query.
> 2. we write a query and sort the companies by revenue (ORDER 
> BY revenue
> DESC).
> 3. the main point ==>> in Statement interface we have a 
> setMaxRows(int max)
> method. The docs say that the driver simply drops rows if 
> excessive rows are
> supplied.
> 4. it seems to work pretty fine at the first glance - at 
> least as the user
> sees it.
> 
> Now, what are the internals for this process? Is it a similar 
> approach to
> writing a DBPROC and FETCH'ing the rows in a loop?
> 
> What interests me most, is 'are we getting only the rows we 
> want through
> connection or is it just a dumb cut and the whole table gets 
> physically
> transmitted under the hood?'.
> 
> __________________________________________________
> Yahoo! Plus
> For a better Internet experience
> http://www.yahoo.co.uk/btoffer
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general
> 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to