SQLite Forum

Default values of reprepare and shrink memory
Login

Default values of reprepare and shrink memory

(1) By Andreas Mueller (amueller) on 2020-12-04 23:37:30 [link] [source]

Hi! I'm not very familiar with the internals of SQLite; I've been working on a project about tunables in databases and looking into SQLite and I'm trying to understand the choice of default values for tunable parameters.

It seems that by default, reprepare and shrink_memory are enabled, but disabling them significantly speeds up the speedtest.

So I wonder if I missed something there. Did I understand the default values correctly?

And I assume that the defaults might not be tuned using the speedtest alone but also some other benchmarks and/or broader experience?

Or does turning either of these off interfere with the correctness of query results (as nosync might).

Any pointers would be appreciated!

Thanks, Andreas

(2) By Richard Hipp (drh) on 2020-12-05 12:29:52 in reply to 1 [link] [source]

It seems that by default, reprepare and shrink_memory are enabled, but disabling them significantly speeds up the speedtest.

These are features of the speedtest1 program, not of SQLite in general.

The reprepare feature causes each prepared statement to be reparsed and reprepared each time it is run. This is done so that the parser, query planner, and code generator logic is well exercised during the performance test, so that we can better identify performance bottlenecks in the part of the code.

The shrink_memory option causes the speedtest1 program to minimize its memory footprint by invoking sqlite3_db_release_memory() interface periodically. Using this option puts additional performance stress on the memory allocation logic inside of SQLite, so that we can better identify bottlenecks in that logic.

Again, these are features of the speedtest1.c program only. They are not settings that ordinary users of SQLite have access to or need to worry with.

(3) By Andreas Mueller (amueller) on 2020-12-07 19:03:30 in reply to 2 [source]

That makes a lot of sense, thank you for the reply! We were a bit confused by these settings but for a stress tests that explains it!

Do you think that overall the speedtest1 is a reasonable way to benchmark the system and tune parameters, or would you say it's too narrow to capture real workloads?

Thanks again!