Changes

Jump to: navigation, search

Performance/Avoid SQLite In Your Next Firefox Feature

560 bytes added, 08:06, 8 April 2014
m
Important Pragmas
* Use a [https://www.sqlite.org/wal.html write-ahead log] for fewer fsyncs
** <code>PRAGMA journal_mode = WAL;</code>
** Though limit the size of the journal, by using a small autocheckpoint and a journal_size_limit about thrice that size
*** <code>PRAGMA wal_autocheckpoint = 16; /* number of 32KiB pages in a 512KiB journal */</code>
*** <code>PRAGMA journal_size_limit = 1536; /* 512KiB * 3 */</code>
** If it's not possible to use WAL journaling, consider using a TRUNCATE journal
* Set the DB cache size based on the device specs, and consider adjusting it dynamically based on memory pressure on mobile devices
** <code>PRAGMA cache_size = X;</code>
* For large DBs prone to fragmentation, pre-allocate a large empty DB initially by increasing the DB's growth increment
** This can be done by calling Connection::SetGrowthIncrement() which changes the value of SQLite's <code>SQLITE_FCNTL_CHUNK_SIZE</code>. See {{bug|581606}} for reference.
* Use a memory temp store if the amount of data in memory entities is acceptable, otherwise temp data will be written to disk, causing unexpected I/O
** <code>PRAGMA temp_store = MEMORY</code>
=== More Tips ===
Confirm
595
edits

Navigation menu