On 2016/05/25 6:15 AM, Brett Ryan wrote:
If I do `select * from table order by id' where id is the primary key, it never 
starts streaming the resultset. I tried leaving this running for 12 hours 
before killing it.

Yeah, if you do that it's going to try to generate an enormous temporary table.
For large tables, you ALWAYS want to be using LIMIT.

The problem with OFFSET is that the further you get into the results, the more 
unnecessary work the engine has to do.

What I used to do, (back when I needed pagination), was to store the PK of the last row in the current "page" of results and add that PK as part of the WHERE clause for the next "page".
That avoids the unnecessary work.

--
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 https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to