Company
Date Published
Author
Matvey Arye
Word count
982
Language
English
Hacker News points
None

Summary

Materialized views have been used in the data ecosystem for decades and are often compared to indexes, but they are viewed as separate entities with different mental models. Indexes are transparent, always returning the same data as querying without an index, while materialized views return stale data unless updated manually. However, time-series data can be optimized using a batch model that re-computes aggregates in a single run, reducing waste and improving efficiency. The goal is to make materialized views act like indexes, with up-to-date and always-correct results, by utilizing the properties of time-series data. A materialization threshold represents a point in time where everything before has been materialized and is up-to-date, while everything afterwards is incomplete or stale. By combining data from before and after this threshold, queries can return fresh and accurate results for all time ranges. The project TimescaleDB is making progress towards achieving this vision with features such as continuous aggregates and automatic usage of materialized views based on queries made to the hypertable.