You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2010/09/22 21:23:41 UTC

svn commit: r1000149 - /subversion/trunk/subversion/libsvn_subr/sqlite.c

Author: rhuijben
Date: Wed Sep 22 19:23:41 2010
New Revision: 1000149

URL: http://svn.apache.org/viewvc?rev=1000149&view=rev
Log:
Make SQLite prefer RAM over temporary files for creating temporary indexes
used by UNION, DISTINCT, INTERSECT, etc.

See http://www.sqlite.org/tempfiles.html#transidx for more details.

This change would have reduced some performance issues in seemingly fast
queries, like the one we already worked around for issue #3499.

* subversion/libsvn_subr/sqlite.c
  (svn_sqlite__open): Set the temp store mode to memory, but don't fail
    if SQLite somehow doesn't support this.

Modified:
    subversion/trunk/subversion/libsvn_subr/sqlite.c

Modified: subversion/trunk/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite.c?rev=1000149&r1=1000148&r2=1000149&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Wed Sep 22 19:23:41 2010
@@ -941,6 +941,11 @@ svn_sqlite__open(svn_sqlite__db_t **db, 
   SVN_ERR(exec_sql(*db, "PRAGMA foreign_keys=ON;"));
 #endif
 
+  /* Store temporary tables in RAM instead of in temporary files, but don't
+     fail on this if this option is disabled in the sqlite compilation by
+     setting SQLITE_TEMP_STORE to 0 (always to disk) */
+  svn_error_clear(exec_sql(*db, "PRAGMA temp_store = MEMORY;"));
+
   /* Validate the schema, upgrading if necessary. */
   if (upgrade_sql != NULL)
     SVN_ERR(check_format(*db, latest_schema, upgrade_sql, scratch_pool));