diff options
Diffstat (limited to 'subversion/libsvn_wc/wc-metadata.sql')
| -rw-r--r-- | subversion/libsvn_wc/wc-metadata.sql | 48 | 
1 files changed, 48 insertions, 0 deletions
| diff --git a/subversion/libsvn_wc/wc-metadata.sql b/subversion/libsvn_wc/wc-metadata.sql index d2a61613ac62..848293d2cebb 100644 --- a/subversion/libsvn_wc/wc-metadata.sql +++ b/subversion/libsvn_wc/wc-metadata.sql @@ -573,6 +573,54 @@ CREATE UNIQUE INDEX I_EXTERNALS_DEFINED ON EXTERNALS (wc_id,                                                        local_relpath);  /* ------------------------------------------------------------------------- */ +/* This statement provides SQLite with the necessary information about our +   indexes to make better decisions in the query planner. + +   For every interesting index this contains a number of rows where the +   statistics ar calculated for and then for every column in the index the +   average number of rows with the same value in all columns left of this +   column including the column itself. + +   See http://www.sqlite.org/fileformat2.html#stat1tab for more details. + +   The important thing here is that this tells Sqlite that the wc_id column +   of the NODES and ACTUAL_NODE table is usually a single value, so queries +   should use more than one column for index usage. + +   The current hints describe NODES+ACTUAL_NODE as a working copy with +   8000 nodes in 1 a single working copy(=wc_id), 10 nodes per directory +   and an average of 2 op-depth layers per node. + +   The number of integers must be number of index columns + 1, which is +   verified via the test_schema_statistics() test. + */ +-- STMT_INSTALL_SCHEMA_STATISTICS +ANALYZE sqlite_master; /* Creates empty sqlite_stat1 if necessary */ + +INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES +    ('NODES', 'sqlite_autoindex_NODES_1',               '8000 8000 2 1'); +INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES +    ('NODES', 'I_NODES_PARENT',                         '8000 8000 10 2 1'); +/* Tell a lie: We ignore that 99.9% of all moved_to values are NULL */ +INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES +    ('NODES', 'I_NODES_MOVED',                          '8000 8000 1 1'); + +INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES +    ('ACTUAL_NODE', 'sqlite_autoindex_ACTUAL_NODE_1',   '8000 8000 1'); +INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES +    ('ACTUAL_NODE', 'I_ACTUAL_PARENT',                  '8000 8000 10 1'); + +INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES +    ('LOCK', 'sqlite_autoindex_LOCK_1',                 '100 100 1'); + +INSERT OR REPLACE INTO sqlite_stat1(tbl, idx, stat) VALUES +    ('WC_LOCK', 'sqlite_autoindex_WC_LOCK_1',           '100 100 1'); + +/* sqlite_autoindex_WORK_QUEUE_1 doesn't exist because WORK_QUEUE is +   a INTEGER PRIMARY KEY AUTOINCREMENT table */ + +ANALYZE sqlite_master; /* Loads sqlite_stat1 data for query optimizer */ +/* ------------------------------------------------------------------------- */  /* Format 20 introduces NODES and removes BASE_NODE and WORKING_NODE */ | 
