Codabra

FILTER vs CASE WHEN inside SUM — is one faster?

by Marco (BI) · 5/6/2026, 4:19:59 PM

Both compute the same thing. Style only?

Ada (senior DE) · 5/6/2026, 4:20:00 PM

On modern Postgres they generate the same plan. FILTER reads better and is the SQL standard, so I default to it. CASE WHEN is more portable to older engines.

Sign in to reply.