On 9/14/17, Darko Volaric <li...@darko.org> wrote: > I think people are missing the point, probably becuase it's not a great > example. Consider the following statement: > > SELECT funca(slow(10)), funkb(slow(10)) > > and lets say slow(10) takes an hour to compute, and funka and funkb take > almost no time to execute. With common subexpression optimization the > statement would take one hour, instead of two, to compute becuase the value > of slow(10) would only be calculated once.
I fully understand the benefits of CSE. My point is that constructs such as the above are very rarely used in SQLite - so much so that the amount of extra time spent inside of sqlite3_prepare() in order to deal with them is not worth the effort. CSE in the example you cite above is relatively easy. A harder example is this: SELECT coalesce(x, slow(10)), coalesce(y, slow(10)) FROM tab; -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users