On Sat, Apr 4, 2015 at 10:17 PM, Noel Grandin <[email protected]> wrote:
> Putting it into a CTE isn't going to make it any faster. Yup; I just realized this. The CTE will be inlined into a nested SELECT right? Ok, I have another question. I put up a counter inside my custom function to see how many times it gets called. And the count is very strange. The table has 90,000 rows. When I execute the SELECT statement without the WHERE clause, the function is called 90,000 times as expected. However, when I add the WHERE clause, which repeats the call to the custom function, I get a count of 150,000 and sometimes it is 160,000! If it was 90,000 or 180,000 it would have made sense; former number means there is Common Subexpression Elimination <https://en.wikipedia.org/wiki/Common_subexpression_elimination>; latter means it is not (the sub-expression is evaluated twice). But, why 150,000? Does some optimisation kick in after a certain number of rows have been processed? thanks, -- *Harshad RJ <http://lavadip.com>* -- 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/d/optout.
