Guest Post: PolyScale Metrics with ClickHouse Materialized Views
Polyscale.ai is an Altinity.Cloud customer and recently documented their journey into ClickHouse materialized views on the Polyscale Blog. We’re delighted to repost the article.
Polyscale.ai is an Altinity.Cloud customer and recently documented their journey into ClickHouse materialized views on the Polyscale Blog. We’re delighted to repost the article.
ClickHouse materialized views provide a powerful way to restructure data in ClickHouse. We have discussed their capabilities many times in webinars, blog articles, and conference talks. One of the most common follow-on questions we receive is whether materialized views can support joins. The answer is emphatically yes.
Materialized views are the killer feature of ClickHouse, and the Altinity 2019 webinar on how they work was very popular. Watch this replay to learn how to use materialized views to speed up queries hundreds of times. We’ll cover basic design, last point queries, using TTLs to drop source data, counting unique values, and other useful tricks. Finally, we’ll cover recent improvements that make materialized views more useful than ever.
by Robert Hodges, Altinity CEO
Presented at Percona Live Amsterdam, October 2, 2019
In the previous blog post on materialized views, we introduced a way to construct ClickHouse materialized views that compute sums and counts using the SummingMergeTree engine. The SummingMergeTree can use normal SQL syntax for both types of aggregates. We also let the materialized view definition create the underlying table for data automatically. Both of these techniques are quick but have limitations for production systems.
In the current post we will show how to create a materialized view with a range of aggregate types on an existing table.
Readers of the Altinity blog know we love ClickHouse materialized views. Materialized views can compute aggregates, read data from Kafka, implement last point queries, and reorganize table primary indexes and sort order. Beyond these functional capabilities, materialized views scale well across large numbers of nodes and work on large datasets. They are one of the distinguishing features of ClickHouse.
Materialized views are a killer feature of ClickHouse that can speed up queries 200X or more. Our webinar will teach you how to use this potent tool starting with how to create materialized views and load data. We’ll then walk through cookbook examples to solve practical problems like deriving aggregates that outlive base data, answering last point queries, and using AggregateFunctions to handle problems like counting unique values, which is a special ClickHouse feature.