0

Once a materialized view in BQ is created, can I do point in time queries using the "for system time as of" syntax? I see limitations in the creation of them here around creation of a materialized view but I couldn't find anything that said there's limitations in querying a materialized view, especially for the system time queries.

CCguy
  • 29
  • 2
  • 8

1 Answers1

0

Just tested it in BQ, didn't realize it would be so easy to set up! It is most definitely not supported, got the following error:

CREATE TABLE `sample_proj.test.sample_table` AS  
SELECT * FROM UNNEST([
  STRUCT(1 AS a, 'Alpha' AS b),
  (2, 'Bravo'),
  (17, 'Bravo'),
  (3, 'Charlie'),
  (4, 'Delta'),
  (3, 'Delta')
])
CREATE MATERIALIZED VIEW  sample_proj.test.materialized_view_sum_sample_table AS (
  SELECT
    b,
    SUM(a) AS sum_a
  FROM
    sample_proj.test.sample_table
  GROUP BY
    b
);
SELECT * FROM `sample_proj.test.materialized_view_sum_sample_table` 
  FOR SYSTEM_TIME AS OF CURRENT_TIMESTAMP();

results in an error saying that materialized views do not support system time as of.

CCguy
  • 29
  • 2
  • 8