On Mon, 2006-01-23 at 20:41 -0500, Michael Bayer wrote: > > the following minor patch makes > > selectone() much faster for large > > result sets: > > hmm does it really ? I am most accustomed to Oracle where getting > just the first row back of a huge result set is not much different > than just getting one
Well, AFAICT selectone() gets more than just the first row back--it fetches and instantiates the entire result set. > (and also, Oracle doesnt even have 'limit', and > I have instead hacked together some "rowid" type of thing that doesnt > work very well, so the below code is not terrfiic for oracle). As far as oracle goes, my experience stopped at 8i, but have you seen the following link? IMHO there's a nice cross-database discussion of limit and offset, that includes an Oracle alternative to rownum--ROW_NUMBER(): http://troels.arvin.dk/db/rdbms/#select-limit I googled "oracle rownum" and the first link that came up is old (from 2001), but it says that rownum doesn't work for the offset case. It sounds like excluding the first row in the where clause means that you'll never get a rownum > 1. IOW, if you have "rownum > 1" in the where clause, the first result row gets rejected, then the next result row gets a rownum of 1, which gets rejected, and so on until you run out of rows. ROW_NUMBER() avoids the problem because the row numbers are generated before the where clauses are applied (rownum is strange in that you can filter on something that is defined downstream of the filtering). Unless they've changed how it works recently, that is. Mitch ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Sqlalchemy-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

