Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Populate Clickhouse MaterializedView with current data?

Tags:

clickhouse

I'm completely new with Clickhouse, and I think I'm asking a very stupid question here but the document is very limited. I'm playing with MaterializedView, and my questions is this: if I create an new MV that joins 2 tables, how do I make sure the view is populated with the current data (not just new data that is inserted after the view is created)?

like image 853
mr1031011 Avatar asked Nov 15 '25 22:11

mr1031011


1 Answers

Quote from official documentation:

If you specify POPULATE, the existing table data is inserted in the view when creating it, as if making a CREATE TABLE ... AS SELECT .... Otherwise, the query contains only the data inserted in the table after creating the view. We do not recommend using POPULATE, since data inserted in the table during the view creation will not be inserted in it.

Also keep in mind that materialized views in ClickHouse work like a trigger for inserts to one table (left), which might work not as you expected in case of JOIN.

like image 183
Ivan Blinkov Avatar answered Nov 18 '25 19:11

Ivan Blinkov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!