Reputation: 83
A is a collapsingMergeTree engine table
CREATE VIEW A AS SELECT * FROM A final;
CREATE MATERIALIZED VIEW a_mview1 TO B AS select id, name from A;
This is not working it seems we can't make mview on view..but why?
Upvotes: 0
Views: 2507
Reputation: 13350
CREATE VIEW A AS SELECT * FROM A final;
It's impossible. Because MV never reads a source table. MV gets inserted blocks from INSERT command.
Upvotes: 1
Reputation: 15226
Normal View doesn't store any data (see doc) so that it is wrong to use it as a source of data for Materialized View.
It needs to create Materialized View based on the origin table:
CREATE TABLE A (
..
) ENGINE = CollapsingMergeTree
.. ;
CREATE MATERIALIZED VIEW a_mview1 TO B
AS
SELECT ..
FROM A
.. ;
Look at the article ClickHouse Materialized Views Illuminated for details.
Upvotes: 1