On 2/21/16, Olivier Mascia <om at integral.be> wrote:
>
> The way I had read that documentation is: if your function is meant to be
> deterministic, returning the same result for the very same input, at least
> for the duration of the SQL statement (or of course always), then you should
> tag it as SQLITE_DETERMINISTIC because it is very valuable for the query
> planner, in order to optimize its calls while compiling a statement.
>
> I am not sure at all, reading the doc, that the query planner brings the
> guarantee that it will make it so there is a singleton call to the function
> (for a given input value) during a statement execution.

Your reading is correct, Olivier.  The SQLITE_DETERMINISTIC flag is a
promise that the implementation makes to SQLite, which allows the
query planner a little more freedom to optimize calls to the function
- for example the freedom to call it once during statement
initialization and reuse the result multiple times, rather than
calling the function multiple times.

-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to