Tech News
← Home  ·  All topics

Database Indexing

1 GoKawiil brief on this topic

Postgres SELECT DISTINCT scans full result set despite indexing, DBOS finds

DBOS engineers debugging a Postgres-backed queue system found that SELECT DISTINCT was their most expensive query, even though it appeared simplest. They discovered that Postgres always scans every row matching a query's predicates when computing DISTINCT values, regardless of indexing or how few unique values exist, making it a poor fit for finding active partitions in a queue workload.