
295.0K
SO“Intern optimized nothing. PostgreSQL optimized nothing. Server optimized sleep mode.” 😌🔥
This query looks simple, but it’s slow because:
data->>’status’ extracts a value from a JSONB column → no normal B-tree index can be used.
(data->>’age’)::int casts text to integer inside the WHERE clause → forces a full table scan.
ORDER BY (data->>’created_at’)::timestamp sorts on a computed value → full sort on millions of rows.
SELECT * returns unnecessary data → more memory + I/O.
So instead of using indexes, PostgreSQL reads every row, parses JSON for each one, casts values, then sorts everything.
On 3M rows?
That’s not a query.
That’s cardio. 💀
[programming, software engineering, software, remote work life, database]
#programming #softwareengineer #software #remoteworklife
@soul_in_code










