There's more than one way to do things | |
PerlMonks |
Re^5: Ranking position in a SQL index (vairants of limit:sybase)by mpeppler (Vicar) |
on Oct 05, 2004 at 19:35 UTC ( [id://396737]=note: print w/replies, xml ) | Need Help?? |
The problem is that to implement "limit" in a truly relational system you really have to internally fetch all the rows before the first row specified in the limit, and then start returning rows. So you're going to do a lot of IOs if you have something like
And of course you should always include an ORDER BY clause as there is no guarantee that the result set will be int the "right" order. On the other hand if you use a WHERE clause the server can limit the IO to the correct pages of data... I have implemented versions of LIMIT by using a temporary table with an identity column, something like: Obviously a lot of IO if you need to find rows located fairly deep into the result set, but acceptable for a pagination system where the user usually only looks at the first few pages... Michael
In Section
Seekers of Perl Wisdom
|
|