IONICWEBCREATOR
Engineering Journal
Backend

The Postgres indexes you actually need

Most slow queries are not a database problem — they are a missing-index problem. A short, practical guide to the handful of indexes that carry most apps.

Jakir Hussian

Jakir Hussian · Founder & Engineering Lead

Apr 14, 20268 min read

Share

Updated Apr 16, 2026

Before you reach for a cache, a read replica, or a rewrite, check the query plan. Most latency we are asked to fix comes down to a sequential scan where an index should be — and adding it is a one-line migration.

Read the plan first

sql
EXPLAIN ANALYZE
SELECT * FROM articles
WHERE published = true
ORDER BY published_at DESC
LIMIT 12;

If you see Seq Scan on a large table with a filter and a sort, you have found the fix.

The partial + composite that covers listings

sql
CREATE INDEX idx_articles_published_recent
  ON articles (published_at DESC)
  WHERE published = true;
  • #Postgres
  • #Performance
  • #Caching
Newsletter

New essays, in your inbox.

Occasional, considered writing on engineering products that scale. No cadence promises, no noise — only when we have something worth your time.

One or two emails a month. Unsubscribe anytime.

Building something that has to scale?

If the way we think about engineering matches the standard you're after, tell us what you're building. We'll be honest about fit and outline a concrete first step.