Opened 9 years ago
Last modified 6 years ago
#11967 closed defect
Support of journal_mode=WAL and synchronous=NORMAL in SQLite — at Initial Version
Reported by: | Jun Omae | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.5 |
Component: | database backend | Version: | |
Severity: | normal | Keywords: | sqlite performance |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Currently, repository resync
command is very slow with mirror of http://svn.edgewall.org/repos/trac on SQLite. Using Write-Ahead Logging feature would be faster. The feature is available since SQLite 3.7.0.
repository resync
with mirror of http://svn.edgewall.org/repos/trac on SQLite:
journal_mode | synchronous | Elapsed | |
---|---|---|---|
DELETE | FULL | 37m44.746s | default |
DELETE | NORMAL | 30m02.647s | |
WAL | FULL | 10m09.947s | |
WAL | NORMAL | 2m39.104s |
functional-test with SQLite:
journal_mode | synchronous | Elapsed | |
---|---|---|---|
DELETE | FULL | 261.468s | default |
DELETE | NORMAL | 235.012s | |
WAL | FULL | 205.513s | |
WAL | NORMAL | 177.595s |
-
trac/db/sqlite_backend.py
diff --git a/trac/db/sqlite_backend.py b/trac/db/sqlite_backend.py index 7b9b139..992e214 100644
a b class SQLiteConnector(Component): 207 207 else: 208 208 cnx = self.get_connection(path, log, params) 209 209 cursor = cnx.cursor() 210 211 journal_mode = params.get('journal_mode', '').upper() 212 if journal_mode == 'WAL' and sqlite_version < (3, 7, 0): 213 journal_mode = None 214 if journal_mode in ('DELETE', 'TRUNCATE', 'PERSIST', 'MEMORY', 'WAL', 215 'OFF'): 216 cursor.execute('PRAGMA journal_mode = %s' % journal_mode) 217 210 218 if schema is None: 211 219 from trac.db_default import schema 212 220 for table in schema: … … class SQLiteConnection(ConnectionWrapper): 290 298 cnx.load_extension(ext) 291 299 cnx.enable_load_extension(False) 292 300 301 synchronous = params.get('synchronous', '').upper() 302 if synchronous == 'NORMAL' and sqlite_version < (2, 8, 0): 303 synchronous = None 304 if synchronous in ('OFF', 'NORMAL'): 305 cursor = cnx.cursor() 306 cursor.execute('PRAGMA synchronous = %s' % synchronous) 307 293 308 ConnectionWrapper.__init__(self, cnx, log) 294 309 295 310 def cursor(self):
Note:
See TracTickets
for help on using tickets.