PostgreSQL Hero
banner
postgresqlhero.bsky.social
PostgreSQL Hero
@postgresqlhero.bsky.social
Want to learn about PostgreSQL? You are in the good place!

🔗 https://postgresqlhero.vercel.app
Reposted by PostgreSQL Hero
Regression testing facility for PostgreSQL queries
December 4, 2025 at 2:53 PM
A SQL query walks into a bar, walks up to two tables and asks...

"Can I join you?"
December 4, 2025 at 10:48 PM
One simple trick to speed up your queries 👇
December 4, 2025 at 10:48 PM
Every MySQL user eventually...
December 4, 2025 at 10:45 PM
PostgreSQL fans be like 🐘
December 4, 2025 at 10:44 PM
Top N per group? LATERAL JOIN.

The most underrated SQL feature.
December 4, 2025 at 10:42 PM
Division by zero? NULLIF handles it.

Returns NULL instead of crashing.
December 4, 2025 at 10:41 PM
Subqueries are unreadable.

CTEs are not. Use WITH.
December 4, 2025 at 10:41 PM
Need a comma-separated list from SQL?

STRING_AGG. No app code needed.
December 4, 2025 at 10:41 PM
INSERT or UPDATE? Both.

ON CONFLICT DO UPDATE = upsert in one atomic query.
December 4, 2025 at 10:41 PM
Need a list of dates? Don't loop.

generate_series() is your friend.
December 4, 2025 at 10:41 PM
COUNT with conditions? Use FILTER.

One query. Multiple counts. No subqueries.
December 4, 2025 at 10:41 PM
INSERT and get the ID back. One query.

Stop doing 2 round trips to your database.
December 4, 2025 at 10:40 PM
PostgreSQL's secret weapon: DISTINCT ON

Get the latest row per group in one query. No window functions needed.
December 4, 2025 at 10:40 PM
Stop writing CASE WHEN for null checks.

COALESCE exists.
December 4, 2025 at 10:40 PM