Stephan, > Le 21 f?vr. 2016 ? 18:22, Stephan Beal <sgbeal at googlemail.com> a ?crit : > > This _might_ suffice for you, but maybe not: the SQLITE_DETERMINISTIC flag > for sqlite3_create_function(). > > Copied from the header file: > > > ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] > ** to signal that the function will always return the same result given > ** the same inputs within a single SQL statement. Most SQL functions are > ** deterministic. The built-in [random()] SQL function is an example of a > ** function that is not deterministic. The SQLite query planner is able to > ** perform additional optimizations on deterministic functions, so use > ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible.
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. -- Meilleures salutations, Met vriendelijke groeten, Best Regards, Olivier Mascia, integral.be/om -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: <http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/attachments/20160221/4d9028de/attachment.pgp>