Hi everyone, I tried to evaluate the following SQL expression : SELECT a, AVG(b) FROM (SELECT a,b FROM Table) GROUP BY a. I know it is a bit silly as the expression is clearly (for a human) equivalent to SELECT a, AVG(b) FROM Table GROUP BY a. Unfortunately, the sql is generated from a program (in a very straightforward way), then prepared in jdbc and executed several times after.
When I'm executing only conditions and joins it works like a charm, it flattens everything and uses the right indexes. But if I try to use a group by, the explain tells me that it performs a FullScan (and therefore do not use the index on a). Note that the problem is the same for views. If I define a view, even a simple one, I can't use the original index on them to perform a group by. I tried to look into the code but I only found out that the group by is performed on a TableView which does not have indexes (getIndexes which is used to determine if a sorted group will be performed). Is there any way to fix this ? Or at least where to look for ? Regards LP -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to h2-database@googlegroups.com. To unsubscribe from this group, send email to h2-database+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.