def activate_pragmas_per_connection(sender, connection, **kwargs):
"""
Activate SQLite3 PRAGMAs that apply on a per-connection basis. A no-op
right now, but kept around as infrastructure if we ever want to add
PRAGMAs in the future.
"""
if connection.vendor == "sqlite":
cursor = connection.cursor()
# Shorten the default WAL autocheckpoint from 1000 pages to 500
cursor.execute(CONNECTION_PRAGMAS)
# We don't turn on the following pragmas, because they have negligible
# performance impact. For reference, here's what we've tested:
# Don't ensure that the OS has fully flushed
# our data to disk.
# cursor.execute("PRAGMA synchronous=OFF;")
# Store cross-database JOINs in memory.
# cursor.execute("PRAGMA temp_store=MEMORY;")
评论列表
文章目录