Company
Date Published
Author
Matt Dupree
Word count
1257
Language
English
Hacker News points
None

Summary

Heap, a digital insights platform, recently introduced Effort Analysis, a feature that allows users to assess the median interactions and engagement time between funnel steps. The development faced a performance challenge when scanning over a billion rows of event data, initially resulting in slower query speeds. The issue stemmed from a PostgreSQL quirk where functions and operators in the query prevented the use of an index-only scan, which is faster than a standard index scan. Heap overcame this by employing a workaround involving partial indexes, which allowed the query planner to utilize an index-only scan by matching the query predicate with the partial index predicate. This adjustment led to a twofold improvement in the p90 performance of the Effort Analysis feature. The company hopes to share these insights to help other teams optimize their PostgreSQL queries effectively.