SQLite is slowing becoming a new standard.
It is fast, and has a growing number of features.
- PRAGMA journal_mode = wal;
- PRAGMA foreign_keys = true;
Query, set, or clear the enforcement of foreign key constraints.
- PRAGMA busy_timeout=….;
In milliseconds, the busy_timeout is associated with each connection to the database and as such you need to set the timeout for each connection.
- pragma synchronous = OFF;
I call this “scissor mode” referring to running with a scissor in hands.
This directive disables the call to fsync and it is very dangerous if a power outrange happens on the host. It delegates to filesystem the “fsync”.
Some database reach full speed disabling fsync call, but your data are not guaranteed to be stored in safe place until operating system flush data (which will eventually occur…).
- NUMERIC type is special….
From the documentation: “A column with NUMERIC affinity may contain values using all five storage classes. When text data is inserted into a NUMERIC column, the storage class of the text is converted to INTEGER or REAL (in order of preference) if the text is a well-formed integer or real literal . . . If the TEXT value is not a well-formed integer or real literal, then the value is stored as TEXT.” So NUMERIC is kind of like TEXT except when the text is a pure number.
- SQLite “.expert” can help you to find out missed indexes:
For most non-trivial SQL databases, the key to performance is creating the right SQL indexes. In this context “the right SQL indexes” means those that cause the queries that an application needs to optimize run fast. The “.expert” command can assist with this by proposing indexes that might assist with specific queries, were they present in the database.
- Hosting SQLite databases on static github pages
- Distinctive Features Of SQLite
- SQLite Autoincrement
- SQLite FAQ
- Why SQLite succeeded as a database (Hacker News)
- SQLite small blob storage: 35% Faster Than the Filesystem (Hacker News)
- SQLite: Small, Fast, Reliable – Choose any three (Hacker News)
- Replicated SQLITE (give a try)