Performance/Avoid SQLite In Your Next Firefox Feature: Difference between revisions

Jump to navigation Jump to search
(First draft)
 
Line 17: Line 17:
=== I/O Patterns ===
=== I/O Patterns ===


* Your database file can suffer from logical/internal fragmentation due to I/O patterns  
* Your database file can suffer from logical/internal fragmentation due to common SQL patterns  
** e.g. if there is a pattern of interleaved writes to indexes and table data, parts of each will end up scattered all over the database file, and queries will not be able to do sequential I/O
** Eg appending data to columns with indexes causes interleaved index and table data. This means both table and index scans are non-sequential until a VACUUM is performed.
** Appending data to multiple tables interleaves tables too.
** Deleting data does not shrink the database, just marks pages as unused.
* Physical/external fragmentation can also happen due to SQLite using inappropriate defaults
* Physical/external fragmentation can also happen due to SQLite using inappropriate defaults
** e.g. the factory-default SQLite [http://www.sqlite.org/pragma.html#pragma_page_size page size] is 1024 bytes. When the default page size was changed to 32KB in {{bug|416330}}, there was a [http://taras.glek.net/blog/2013/06/28/new-performance-people/ 4x reduction in SQLite IO waits] according to Telemetry
** e.g. the factory-default SQLite [http://www.sqlite.org/pragma.html#pragma_page_size page size] is 1024 bytes. When the default page size was changed to 32KB in {{bug|416330}}, there was a [http://taras.glek.net/blog/2013/06/28/new-performance-people/ 4x reduction in SQLite IO waits] according to Telemetry
Confirmed users
381

edits

Navigation menu