Ranks statements by total time spent. Needs the pg_stat_statements extension enabled.
Language
Snippets written in Sql
Uses a window function to number the duplicates and removes everything but the first of each group.
On Postgres 11 and later a nullable column with a default is a metadata-only change. Adding NOT NULL afterwards is the part that needs care.
Lists indexes that have never been scanned, which are pure write cost. Check against a long uptime before dropping any.
Inserts, or updates the existing row when the unique column already holds that value.
Where the disk actually went, including indexes and TOAST.
Returns one row per author with their posts nested, instead of a join that repeats the author on every row.
Copying rows with explicit ids leaves the identity sequence behind, so the next insert collides with an existing row.