I can give my experience (not big, 2 or 3 M) with à complex request sorting on a column : without index more than 15 minutes, with index 7 seconds.
2012/6/8 Noel Grandin <[email protected]> > H2 doesn't support stepping through an index backwards, you would need to > create a reverse index to support that. > > Something like : > > create index idx_id_desc on test(id desc) > > > On 2012-06-07 16:04, Petr Holik wrote: > >> Hello, >> >> I am little bit unsure when index is used for sorting and when not. I >> have two almost same SQL first uses sort using index and second not. >> The only difference is in DESC keyword. >> >> the SQL is as follows: >> >> select * from bills where closedtime< '2012-06-08 12:04:36.343 ' AND >> CLOSED = TRUE order by closedtime limit 1 >> select * from bills where closedtime< '2012-06-08 12:04:36.343 ' AND >> CLOSED = TRUE order by closedtime DESC limit 1 >> >> of course i can supply explain analyze if needed. Second query on same >> data is about 10 - 100 times slower(does not use index for sorting) >> >> Where is mistake or am I missing something? >> >> Sincerely Petr Holik >> >> > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to h2-database+unsubscribe@** > googlegroups.com <h2-database%[email protected]>. > For more options, visit this group at http://groups.google.com/** > group/h2-database?hl=en <http://groups.google.com/group/h2-database?hl=en> > . > > -- Si vous vous intéressez à l'histoire, vous pouvez parcourir mon site : http://histoiremondiale.free.fr -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
