On Mar 21, 11:07 pm, Maaartin <[email protected]> wrote: Replying to myself :D
> Removing the "--" leads to using the other PK and sorting which takes > 2187 ms. In such a case both possible indexes should be examined and > the one allowing index sort chosen. I see that the optimizer can't see the SORT part at all, which is quite understandable, since it's already complicated enough. This way both possible plans in this example are equally good for the optimizer, so the outcome is essentially random. Ignoring SORT during planning is probably fine most of the time, just in queries LIMIT-ing an otherwise huge result set the sorting part may become the most important one. In the end the plan could look like (invalid SQL necessary for making the proper execution order clear) ORDER BY details.action LIMIT 10 /* cost: 10, using idx_action */ SELECT * FROM details /* cost: 20, index scan using idx_action */ JOIN master ON details.filepath = master.filepath /* cost: 30, using PK */ Just talking to myself. I'm curious if I could improve the optimizer. -- 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.
