> On Nov 8, 2019, at 11:08 AM, Mario M. Westphal <m...@mwlabs.de> wrote: > > The EXPENSIVE_FUNCTION function is referred multiple times in the update > statement. But it always returns the same result (for any given row).
There was a similar thread (that I started, I think) from two years ago with subject "Common subexpression optimization of deterministic functions". It's worth a read. The takeaway is that SQLite's query optimizer does not remove redundant calls to a deterministic function. IIRC, there weren't any good workarounds for this. … But this makes me think of the upcoming virtual column feature. If you define a virtual table column whose value is equal to EXPENSIVE_FUNCTION(), do multiple references to that column in a query cause multiple calls to the function, or is it computed only once per row? —Jens _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users