xxxxxxxxxx
-- Creating the materialized view
CREATE MATERIALIZED VIEW my_materialized_view
AS
SELECT column1, column2, aggregate_function(column3) AS aggregated_column
FROM my_table
GROUP BY column1, column2;
-- Refreshing the materialized view (manually or periodically)
REFRESH MATERIALIZED VIEW my_materialized_view;
-- Querying the materialized view
SELECT * FROM my_materialized_view;