extremely speedup of all database operations:

- (synchronous = OFF) write data through OS without syncing
- (journal_mode = MEMORY) use memory for the transaction logging
pull/1436/head
sebres 2016-05-20 12:03:35 +02:00
parent 34ae0b916e
commit db9e724038
1 changed files with 5 additions and 2 deletions

View File

@ -182,8 +182,11 @@ class Fail2BanDb(object):
raise
cur = self._db.cursor()
cur.execute("PRAGMA foreign_keys = ON;")
cur.execute("PRAGMA foreign_keys = ON")
# speedup: write data through OS without syncing (no wait):
cur.execute("PRAGMA synchronous = OFF")
# speedup: transaction log in memory, alternate using OFF (disable, rollback will be impossible):
cur.execute("PRAGMA journal_mode = MEMORY")
try:
cur.execute("SELECT version FROM fail2banDb LIMIT 1")
except sqlite3.OperationalError: