Re: [h2] Are order of results always the same?
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 h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Are order of results always the same?
Hi, You need to add "order by". Regards, Thomas On Wed, Nov 25, 2015 at 5:05 PM, Adam McMahonwrote: > 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 h2-database+unsubscr...@googlegroups.com. > To post to this group, send email to h2-database@googlegroups.com. > 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 h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
[h2] Are order of results always the same?
Hi, It looks like the results of a querry are always given back in the same order. Is this always true? I know the order of a returned result is not the same as the insertion order. But if a query is performed, and then repeated, will the result set be in the order (assuming the relevant tables have not changed? Thanks, -Adam -- 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 h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
Re: [h2] Are order of results always the same?
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 h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.