PostgresAI (@postgres_ai) header
PostgresAI (@postgres_ai) profile picture

We build Self-Driving Postgres and help fast-growing startups scale their databases, workloads, and related operations

remote
Joined July 2020
Photo by PostgresAI (@postgres_ai)Photo by PostgresAI (@postgres_ai)Photo by PostgresAI (@postgres_ai)Photo by PostgresAI (@postgres_ai)Photo by PostgresAI (@postgres_ai)Photo by PostgresAI (@postgres_ai)Photo by PostgresAI (@postgres_ai)Photo by PostgresAI (@postgres_ai)Photo by PostgresAI (@postgres_ai)Photo by PostgresAI (@postgres_ai)
Postgres feeling unwell? Paste one prompt into your AI agent. It sets up @postgres_ai monitoring 📊📈 then finds the root cause. Here: long open transactions holding locks. 26 seconds. Works with Claude Code, Cursor, Codex, or any agent that runs commands. Any Postgres: self-managed, Supabase, RDS (+ more coming soon) link 👇
16
3
31
2,092
Random UUID primary keys look fine on day one: id uuid default gen_random_uuid() primary key At scale, INSERTs run much slower. Postgres 18.6, 16 clients, single-row inserts, same server: → small table: UUIDv4 at 0.95–1.10x of UUIDv7 → 100M rows: 0.62–0.69x of an ordered key → WAL per row: 1.5–1.9x → index size: +33% vs UUIDv7 Each UUIDv4 insert lands on a random leaf, so the whole index is hot. Past memory, almost every insert reads a page and evicts another one. Postgres 18 has uuidv7(). For an existing table, one statement under a short lock_timeout: alter table t alter column id set default uuidv7(); 7 runs, 14 hypotheses written down before the first row. Link below 👇
9
10
1
52
3,939
Wait dashboard: row lock, 2.3%. Ignore it? agents attempt to fix: 👉 synchronous_commit=off: p99.9 11.0 → 11.4 ms 👉 2 GiB shared_buffers: 11.0 → 11.3 ms In slow requests, it was the main wait: 51% Fix: lock 5 rows at a time, not 100 → 5.8 ms By Dmitry Fomin, link below 👇
2
1
1
300
postgres.ai/blog/20261103-wh… Why didn't the ASH dashboard help? Sampling gives accurate shares of time, but a 12 ms request gets one or two 10 ms samples, and per-queryid views mix fast and slow runs. Read the post and follow us for part 2 – we'll discuss how to record EVERY wait.
1
1
3
277
One slow checkout, 12.63 ms, replayed from its own waits. Most of it: waiting for a row lock. A 10 ms sampler took one look at it.
1
2
252
PostgresAI retweeted
How we tested: ~2.1B UUID rows across 7 runs, driven by AI agents in DBLab Forge, PostgresAI's experiment platform. ~1.5B tokens (mostly cached context; ~10.5M generated). Every number, chart and config 📊 console.postgres.ai/shared/b…
1
1
577
PostgresAI retweeted
What happens when a random-key index outgrows shared_buffers? And what does UUIDv7 reveal about your data? Kirk Wolak and Nik dig into both in episode 194 🎙️ ▶️ youtube.com/watch?v=gf8e3JkQ… 🎧 postgres.fm/episodes/uuidv4-…
1
2
9
1,469
PostgresAI retweeted
🚨 UUIDv4 or UUIDv7 for your Postgres primary key? We inserted 2 billion UUIDs to settle it. 100M rows. Postgres 18. 1 GiB shared_buffers. ⚡ int8: 23.5k inserts/s ⚡ UUIDv7: 21.7k inserts/s 🐌 UUIDv4: 13.9k inserts/s UUIDv4 starts slowing at ~26M rows. Why? 👇
7
18
138
15,570
Why does this keep happening? pg_restore doesn't do it for you. Autovacuum does it eventually: in tests from my blog post, after 6 s to 6+ minutes. And (!) it never analyzes partitioned parents. Yes, Postgres could do a better job. But also most existing guides stop at "pg_restore finished". I checked 28 of them, incl. Postgres docs, AWS, Google Cloud, Azure, Supabase, Neon: → only 8/28 say to run ANALYZE → only 3/28 say to run VACUUM → and just 1 explains what visibility maps are Only one tells the whole story. Full research, all 28 pages: github.com/NikolayS/postgres… So teams step on the same rake 🤕 ✅ Check your runbooks, scripts and AI agent skills. Before traffic: vacuumdb --analyze --jobs 4 # adjust plus ANALYZE each partitioned parent Follow me for more Postgres tips the docs leave out.
pg_dump + pg_restore finished. Exit code 0. Row counts match. Your database is not ready yet. One query, 250M rows, Postgres 18.6, cold cache: → right after pg_restore: 32.6 s → after ANALYZE: 6.1 s → after VACUUM ANALYZE: 23 ms 💥 Same data. ~1,400× faster. A logical dump does not carry the visibility map, and by default not the planner statistics. 25 of 28 migration guides we checked don't say to run VACUUM after the load. Before traffic: vacuumdb --analyze --jobs 4 then ANALYZE each partitioned parent All tests are reproducible, and the scripts are in the post (bonus: podcast episode) 👇
4
2
25
1,846
pg_dump + pg_restore finished. Exit code 0. Row counts match. Your database is not ready yet. One query, 250M rows, Postgres 18.6, cold cache: → right after pg_restore: 32.6 s → after ANALYZE: 6.1 s → after VACUUM ANALYZE: 23 ms 💥 Same data. ~1,400× faster. A logical dump does not carry the visibility map, and by default not the planner statistics. 25 of 28 migration guides we checked don't say to run VACUUM after the load. Before traffic: vacuumdb --analyze --jobs 4 then ANALYZE each partitioned parent All tests are reproducible, and the scripts are in the post (bonus: podcast episode) 👇
16
22
2
192
14,906
something spiked 10 minutes ago. pg_stat_activity already forgot. pg_ash remembers. Active Session History for any Postgres -- pure SQL, no extension, no restart. RDS, Cloud SQL, Supabase, AlloyDB, Neon. in 2.0 (currently rc1): - redesigned to be easier to use, for humans and agents - unified AAS metrics - up to 23x faster reads tested on PG 14–19rc1 free, Apache 2.0 setup: \i sql/ash-install.sql select ash.start('1 second'); github.com/NikolayS/pg_ash -- ASH for Postgres, in pure SQL
3
5
30
2,174
postgresai 0.17 is out! - outbound-only agent: the platform never connects to your instance - new pgai promql - autovacuum checks use each table's real trigger point - pg_stat_statements from all databases - VictoriaMetrics admin keys …and much more: gitlab.com/postgres-ai/postg…
1
4
399
PostgresAI retweeted
New episode: "pg_stat_log" Nik and Michael are joined by @fabriziomello to discuss his new extension pg_stat_log. 🎧 postgres.fm/episodes/pg_stat… 📺 youtu.be/xr5kv1WUdWM
1
6
2
11
4,057
finally got dark theme in console.postgres.ai
1
10
1,086
PgQue got a website with docs – pgque.dev
5
32
219
14,234
"you can't have superuser" "you can't install that extension" "you can't access WAL" "it's for your protection!" no. it's free software -- handed back to you with the freedom removed, and the cage painted as safety Postgres is free. that freedom is the whole point. you don't need protection from the database you've run for decades. you need access to it. full control. and ownership.
2
3
44
4,722
PgQue v0.2.0: 🐍 Python, 🟦 TypeScript, 🐹 Go clients ⚡️ send_batch() performance optimized 👥 subconsumers to scale consumption near-linearly ⏱️ sub-second ticking and 10 ticks/sec by default (incl. with pg_cron) 🧩 pg_cron, pg_timetable, pg_tle paths PgQue is a highly-efficient, zero-bloat Postgres queue built on top of on battle-proven Skype's PgQ. One SQL file to install, pg_cron to tick. Works in any Postgres.
5
7
44
2,454