You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Understand error on materized view refresh concurrently.
ERROR: cannot refresh materialized view "public.mvw_prod" concurrently
HINT: Create a unique index with no WHERE clause on one or more columns of the materialized view.
create materialized view mvw_prod asselect productid, productname, supplierid from products join categories using(categoryid) where productid>5;
createunique indexuidx_product_nameon mvw_prod(productname) where1=1; -- so where is allowed
refresh materialized view concurrently mvw_prod;
Does not work
create materialized view mvw_prod asselect productid, productname, supplierid from products join categories using(categoryid) where productid>5;
createunique indexuidx_product_nameon mvw_prod(productname);
-- where is not allowed on column of materialized view(mvw) as it filters out rows of mvw, but we need to have unique index on
all rows of mvw..
refresh materialized view concurrently mvw_prod;