logoalt Hacker News

chasilyesterday at 10:59 PM0 repliesview on HN

Some observations:

1. Stats are used by "Cost-Based Optimizers."

I think this is the most appropriate wiki:

https://en.wikipedia.org/wiki/Query_optimization

On my Oracle databases, I run the dbms_stats.gather_database_stats package procedure once a week. SQL Server also has stats for sure, and I would be surprised by a relational database that did not.

SQLite will quietly gather stats with each database connection. Running an explicit analyze devotes full attention to an otherwise piecemeal group effort.

2. I don't think rows are physically removed when deleted, instead they are marked. Removal will definitely happen at vacuum.

3. There is a backup command in the CLI that will make a transaction consistent copy of the database file, and there are lower-level C functions behind it that can be used with object code.

4. It is important to remember the many restrictions of WAL mode, including the impact on ATTACHing multiple database files: ACID consistency is lost.

https://sqlite.org/lang_attach.html

'Transactions involving multiple attached databases are atomic, assuming that the main database is not ":memory:" and the journal_mode is not WAL.'