To further emphasize this point: A table has no order by itself, and you should make no assumptions about the order of rows you will get back in a select statement, unless you use an ORDER BY clause.
From: walterheck@stripped [mailto:walterheck@stripped] On Behalf Of Walter Heck - OlinData.com
Sent: Tuesday, August 18, 2009 9:51 AM
Subject: Re: Query Question
if you use an order by clause in your query, the limit will pick the first
100K rows in that order. That way you can ensure that all rows will be
processed in (wait for it...) order :)
On Tue, Aug 18, 2009 at 18:44, Bill Arbuckle <bill@stripped> wrote:
> I am in need of some help for the following:
> Say I have a table with 1M rows. Users are being added constantly (not
> deleted) during the queries that I am about to explain. The pk is uid and
> appid. I need to run queries in increments of 100K rows until reaching the
> end without duplicating rows in the queries. I am using a select statement
> with a limit of row_index and row_count. This start row is where my
> question arises.
> If I make a query with limit 0,100000 then 2 minutes later 100000,100000
> then 2minutes later 300000,100000 and so on. My question is are new rows
> added to the end of the table or will they randomly appear in my queries?
> If they are added to the end of the table, that is fine because I will pick
> them up in my final pass.
> I hope this is clear enough. If not, let me know and I will provide more
> information. Thanks!
Walter Heck, Engineer @ Open Query (http://openquery.com)
Affordable Training and ProActive Support for MySQL & related technologies
Follow our blog at http://openquery.com/blog/
OurDelta: free enhanced builds for MySQL @ http://ourdelta.org
The information contained in this transmission may contain privileged and confidential information. It is intended only for the use of the person(s) named above. If you are not the intended recipient, you are hereby notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.