CREATE OR REPLACE TABLE temp.test (X INT64 NOT NULL);
INSERT INTO temp.test (X) VALUES (1);
CREATE MATERIALIZED VIEW temp.view_test AS SELECT X FROM temp.test;
SELECT X FROM temp.view_test; -- One record returned
TRUNCATE TABLE temp.test;
SELECT X FROM temp.view_test; -- Zero records returned
INSERT INTO temp.test (X) VALUES (1);
DROP MATERIALIZED VIEW temp.view_test;
CREATE MATERIALIZED VIEW temp.view_test AS SELECT X FROM temp.test;
INSERT INTO temp.test (X) VALUES (2);
SELECT X FROM temp.view_test; -- Two records returned
是的,物化视图反映了所有 DDL,包括
TRUNCATE
创建视图之前的事件。这很容易测试: