Hosting Operations
Count Rows in Key SQLite Tables
You need row counts for several important SQLite tables in one command.
Command
sqlite3 app.db "SELECT 'users', count(*) FROM users UNION ALL SELECT 'orders', count(*) FROM orders UNION ALL SELECT 'events', count(*) FROM events;"
What changed
Nothing changes. The command reads row counts from selected tables.
Danger
safe
When to use it
Use during data sanity checks, imports, restores, or incident triage.
When not to use it
Do not run huge counts blindly on very large production databases without understanding cost.
Undo or recovery
No undo needed because this command is read-only.
Expected output
Pipe-separated table names and row counts.
demo script
Disposable terminal steps
sqlite3 app.db ".tables"sqlite3 app.db "SELECT 'users', count(*) FROM users UNION ALL SELECT 'orders', count(*) FROM orders UNION ALL SELECT 'events', count(*) FROM events;"
simulated output
What it looks like
::fixture-ready::
$ sqlite3 app.db ".tables"
events orders schema_migrations users
::exit-code::0
$ sqlite3 app.db "SELECT 'users', count(*) FROM users UNION ALL SELECT 'orders', count(*) FROM orders UNION ALL SELECT 'events', count(*) FROM events;"
users|4
orders|7
events|12
::exit-code::0
YouTube Short
Count key tables fast.
Union a few count queries when you need quick data sanity checks across important SQLite tables.
LinkedIn hook
A quick row count can reveal empty imports, runaway events, or missing data.
Question: Do you check row counts after restoring a SQLite backup?
experiments
A/B tests to run
Metric: save_rate
A: Import sanity check.
B: Count the key tables.