On Fri, Nov 8, 2019 at 9:20 PM Keith Medcalf <kmedc...@dessus.com> wrote:

> [...] The optimizer is prone to calculating things more often than it
> needs to, and is difficult to force to "materialize" things.

Since your expensive function needs to be calculated for every row of the
> table anyway, it would be better to just create a table

that has it calculated once, then compute the updates table, then perform
> the update, then get rid of the extra tables. [...]
>

A better option IMHO is for the function itself to memoize its results, for
the duration of the statement's execution.
That way even if it's called multiple times, you can fetched the cached
result instead of re-performing the expensive computation.

Use https://www.sqlite.org/c3ref/get_auxdata.html for the caching. --DD

PS: Didn't read the whole thread in detail, maybe my answer is a bit off
topic :)
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to