Hi,

You need to add "order by".

Regards,
Thomas


On Wed, Nov 25, 2015 at 5:05 PM, Adam McMahon <[email protected]> wrote:

> Thanks for your pointer on this.
>
>
> What about this scenario:
>
>
> I have a rather large table that I would like to process in the
> application in batches using a paging mechanism with OFFSET and LIMIT. I
> plan to do this in a simple loop which gets results N at a time, and each
> time increasing the OFFSET by N. I don't care the order in which these
> items are processed, but I need to make sure all are processed.
>
>
> If subsequent SELECTS do not have the same order, does that effect the
> above scenario? In other words, if OFFSET/LIMIT trims the results sent back
> to the client, could the OFFSET/LIMIT be trimming at different places in
> the SELECT such that a loop with OFFSET/LIMIT never actually goes through
> the entire table, but instead sends back an arbitrary set.
>
>
> For example, lets say I have a table with 50 names. I want to process
> these names 10 at a time, so I create a simple loop using OFFSET/LIMIT.
> Without adding in an ORDER BY, will it actually go through all 50 names. Or
> do I need to add an ORDERBY to ensure that the OFFSET knows what index to
> start at in the SELECT.
>
>
> I hope this makes sense.
>
>
> -Adam
>
>
> On Wednesday, November 25, 2015 at 2:52:22 AM UTC-5, Noel Grandin wrote:
>>
>> You can't rely on that. If you need order, you need to enforce it with an
>> ORDER BY clause.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to