Get the latest tech news

The DISTINCT in Your COUNT


COUNT(DISTINCT) has no combine function, so PostgreSQL can't merge per-worker results: the whole statement drops to one core and a disk-spilling sort. Push the distinctness into a GROUP BY instead and parallel query comes back.

None

Get the Android app

Or read this on Hacker News

Read more on:

Photo of count

count

Photo of DISTINCT

DISTINCT

Related news:

News photo

How a Yale AI-cheating dispute became a 13-count federal lawsuit

News photo

HyperCard discovery: Neuromancer, Count Zero, Mona Lisa Overdrive (2022)

News photo

Index, Count, Offset, Size