Hi, It is possible to optimize this, but it is not so easy. I wonder how MySQL is doing it internally.
The best way I know to optimize it is using a "counted b-tree". This is possible with the MVStore (the future storage engine for H2). However support for transactions makes it more complicated, so I'm not sure if it really makes sense to optimize it. Regards, Thomas On Thu, Jul 11, 2013 at 11:50 AM, pittlu <[email protected]> wrote: > Just for write a database performance report and mysql faster than h2 when > use similar function.Anyway thanks very much for your advice. > > 在 2013年7月11日星期四UTC+8下午5时30分56秒,Noel Grandin写道: > >> You could try using an index like this: >> SELECT * FROM VSSQ_USER LIMIT 10 OFFSET 600000 ORDER BY ID__ >> >> But even that is not going to be particularly fast because it will still >> have to iterate through the whole index to find the right position. >> >> The correct answer is "don't do that". >> Why on earth on would you be trying to do that anyhow? >> >> On 2013-07-11 10:33, pittlu wrote: >> > There is a table named vssq_user contains 1,000,000 records,the >> > following SQL query takes more than 20 seconds: >> > SELECT * FROM VSSQ_USER LIMIT 10 OFFSET 600000 >> > >> >> -- > 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/groups/opt_out. > > > -- 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/groups/opt_out.
