Guides
Answers for the moments a database gets in the way, written for people with the problem in front of them.
Database errors
What an error means and how to fix it, reproduced on real servers.
- attempt to write a readonly database
- canceling statement due to lock timeout
- canceling statement due to statement timeout
- cannot drop because other objects depend on it
- column does not exist
- column must appear in the GROUP BY clause or be used in an aggregate function
Is this migration safe?
Which lock each schema change takes and whether it rewrites the table.
- Does adding a CHECK constraint lock the table in PostgreSQL?
- Does adding a column with a default rewrite the table in PostgreSQL?
- Does adding a foreign key lock both tables in PostgreSQL?
- Does adding a primary key lock the table in PostgreSQL?
- Does adding a UNIQUE constraint lock the table in PostgreSQL?
- Does adding an index lock the table in MySQL?
EXPLAIN, explained
Every step of a query plan, and what to do when it’s the slow one.
- Aggregate in PostgreSQL EXPLAIN
- Append in PostgreSQL EXPLAIN
- Bitmap Heap Scan in PostgreSQL EXPLAIN
- Bitmap Index Scan in PostgreSQL EXPLAIN
- Buffers: shared hit, read, dirtied, written in PostgreSQL EXPLAIN
- cost and rows estimates in PostgreSQL EXPLAIN
PostgreSQL lock modes
PostgreSQL’s lock modes, what blocks what, and who holds it now.
- ACCESS EXCLUSIVE lock in PostgreSQL
- ACCESS SHARE lock in PostgreSQL
- EXCLUSIVE lock in PostgreSQL
- ROW EXCLUSIVE lock in PostgreSQL
- ROW SHARE lock in PostgreSQL
- SHARE lock in PostgreSQL
Connect from your Mac
Connecting to hosted and local databases from a Mac.
- Connect to Amazon Aurora PostgreSQL from your Mac
- Connect to Amazon RDS for MySQL from your Mac
- Connect to Amazon RDS for PostgreSQL from your Mac
- Connect to Azure Database for PostgreSQL from your Mac
- Connect to Crunchy Bridge from your Mac
- Connect to DigitalOcean Managed PostgreSQL from your Mac
Connection strings
URL formats, options, and encoding passwords.
- MongoDB connection string: mongodb:// and mongodb+srv:// explained
- MySQL connection string: mysql:// URLs, mysql flags and option files
- PostgreSQL connection string (URI and key/value) explained
- Special characters in database passwords: percent-encoding connection URLs
- SQLite connection strings: file paths, file: URIs and in-memory databases