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
ARRAY_AGG is one of those functions you wish you knew about sooner
December 5, 2025 at 9:47 AM
Timezones in SQL be like
December 5, 2025 at 9:41 AM
This is why we have backups. You have backups, right?
December 5, 2025 at 9:37 AM
When you give AI database access
December 5, 2025 at 9:36 AM
FUN FACT: https://postgresqlhero.vercel.app runs a full PostgreSQL database directly in your browser using PGlite.

No server. No backend. Just WASM magic under 3MB.

Learn SQL for free without us paying a cent for infrastructure 🐘
December 5, 2025 at 9:27 AM
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