YOUR AD GOES HERE

SELECT * pulled 7.3 MB for a 1,000-post list: 47 ms vs 2.25 ms with named columns #shorts

Published 28, Nov 2026

backendskills00


Description:
postgres select star slow jsonb column

A list of 1,000 posts (SELECT * FROM posts ORDER BY created_at DESC LIMIT 1000) pulled 7.3 MB of column values and took 47.4 ms in node-postgres, because SELECT * also fetches each post's 7.5 KB jsonb content, which the list never shows. EXPLAIN ANALYZE said 0.3 ms: the time goes into de-TOASTing, sending and parsing the jsonb. Naming the 4 columns the list renders (id, author_id, title, created_at) sent 68 KB and took 2.25 ms, 21x faster. A 50-post page: 2.07 ms vs 0.62 ms. Medians of 21 random pages, 1M posts, PostgreSQL 16, local unix socket (over a network the 108x extra bytes also cost transfer time). ORMs that select every column by default do the same.

The Backend Skills Pack covers this (slow-query profiling skill for Claude Code): https://adnology0.gumroad.com/l/backend-skills-pack

Follow for one backend trap a day.

#postgres #postgresql #backend #sql #database #webdev #programming #shorts

Releted More Videos

  • Sorry!!! Nothing to show

You May Also Like

YOUR AD GOES HERE

YOUR AD GOES HERE