Checkout
rhuijben
committed
on 17 Nov 13
Teach Sqlite a bit of how we use our working copy database files, like that
we only have one true value in wc_id.

By adding this tiny bit o… Show more
Teach Sqlite a bit of how we use our working copy database files, like that

we only have one true value in wc_id.

By adding this tiny bit of information Sqlite 3.8.0, 3.8.1 and the preview

of 3.8.2 use the intended query plans for our working copy queries, just

like Sqlite 3.7.12-3.7.17 already did without these hints.

(The older versions do use this information though!)

For more details on why this is important and how this works see

- the wc-metadata.sql patch

- http://www.sqlite.org/queryplanner-ng.html

- http://www.sqlite.org/fileformat2.html#stat1tab

And for reference also check the users@sqlite archive where Richard Hipp

recommends this approach for our current use of Sqlite.

* subversion/libsvn_wc/upgrade.c

 (svn_wc__upgrade_sdb): Call svn_wc__db_install_schema_statistics() after the

   final format bump.

* subversion/libsvn_wc/wc-metadata.sql

 (STMT_INSTALL_SCHEMA_STATISTICS): New statement.

* subversion/libsvn_wc/wc_db.c

 (svn_wc__db_install_schema_statistics): New function.

* subversion/libsvn_wc/wc_db.h

 (svn_wc__db_install_schema_statistics): New function.

* subversion/tests/libsvn_wc/wc-queries-test.c

 (schema_statements): Install the statistics.

 (parse_stat_data): New helper function.

 (test_schema_statistics): New test.

 (test_funcs): Add test_schema_statistics.

Show less