Company
Date Published
Author
Billy Ceskavich
Word count
1720
Language
English
Hacker News points
None

Summary

Knock, a company providing flexible notifications infrastructure, leverages PostgreSQL as its primary datastore to handle workflow configurations and notification records, leading to experiences in optimizing indexing strategies for database tables. The text outlines several key lessons in indexing, emphasizing the balance between storage and write costs associated with adding indexes, as well as the various methods PostgreSQL employs to read indexed data, such as sequential, index-only, index, and bitmap index scans. It highlights the importance of understanding when to use combined versus multicolumn indexes, noting that the latter can be more efficient if queries align with the order of columns. Additionally, the guide discusses using sorted indexes to enhance performance for ordered queries with limits and stresses the need to trust and work in harmony with PostgreSQL's query planner. By focusing on strategies that maximize query efficiency, Knock aims to optimize database performance, acknowledging that it's impossible to cater to every query pattern but striving for the most effective indexing within their unique use case.