[thelist] DB "Limit" Command Question

Luther, Ron Ron.Luther at hp.com
Thu Apr 16 16:05:51 CDT 2009


Chris Anderson noted:

>>They are not "random" when you do not include an ORDER BY clause.
>>The rows start coming in the order they are found (and these may even be
>>in a predictable order 


Hi Chris,

Yeah, you're right, we were being a bit lax there.  I usually call it the "first n" records rather than a "random n" - since it usually isn't. [1]

I also especially like the dbs that support tools that allow the "gimme n records starting after m records" syntax (like MySQL) since those let you do fun (and often useful) things like pulling 25 records after the first million in the table.  This can come in real handy because there often are patterns or repetitive cycles in the physical db and this can work a treat at getting past those and testing the data that you are _really_ interested in.  [Especially if the physical structure is based off a non-indexed field ... like record create date if you are merely appending data each day ... that kind of thing.]


>>The TOP (or LIMIT in MYSQL) just means that when that number of rows has
>>been sent, it stops processing the results.

Yeah, that seems to be the answer - I'm dealing with an unusual situation.


Thanks!
RonL.

[1] And I'm only saying 'usually' since I'm not 100% certain what the random-access db structures do.  But I haven't worked with any of those in ages so I'm not real worried about it.




More information about the thelist mailing list