On Wed, Dec 11, 2013 at 3:00 PM, Nick Hutchinson <[email protected]>wrote:

>  I ran my test app under Visual Studio's profiler, and saw that a
> substantial amount of time is spent in calls to sqlite3Reprepare(). Reading
> the docs at http://www.sqlite.org/c3ref/prepare.html, I assume SQLlite is
> recompiling the statement because it thinks it can find a better query plan
> based on the parameters I'm binding to it.
>


Correct.  With SQLITE_ENABLE_STAT[34], whenever you change parameter
bindings, SQLite is forced to reprepare the statement.  This is because the
choice of algorithm depends upon the actual values bound to parameters.  In
your case, the changes to the bound parameters does not make a difference
in the algorithm, but SQLite has no way of knowing that without going
through the whole re-prepare process.

Yes, this might require more time preparing statements.  That's one of the
trade-offs for using SQLITE_ENABLE_STAT[34].  And, that is also why
STAT[34] is disabled by default.


-- 
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to