Company
Date Published
Nov. 7, 2024
Author
James Blackwood-Sewell
Word count
815
Language
English
Hacker News points
8

Summary

The text discusses the efficiency of DISTINCT queries in PostgreSQL and how TimescaleDB's SkipScan feature can optimize these queries by up to 10,548x at p50 and 9,603x at p95. It explains that standard PostgreSQL doesn't pull unique values directly from ordered indexes, leading to slowdowns as tables grow larger. SkipScan enhances the efficiency of SELECT DISTINCT ON .. ORDER BY queries by allowing PostgreSQL to directly jump to each new unique value within an ordered index, skipping over intermediate rows. The text also presents a benchmark comparing SkipScan with standard PostgreSQL in a more realistic environment with ingest and query running at the same time. The results show that SkipScan performs significantly faster than standard PostgreSQL and maintains stable performance throughout the run.