I have a materialized view in Postgres, and want to know what locks (if any) are taken out when refreshing that view.
CREATE TABLE people ( name VARCHAR(30) );
INSERT INTO people VALUES ('Alice'), ('Bob'), ('Cher');
CREATE MATERIALIZED VIEW test AS SELECT * FROM people;
REFRESH MATERIALIZED VIEW test;
Specifically, I'm trying to understand whether the REFRESH MATERIALIZED VIEW
command takes out an ACCESS EXCLUSIVE
lock.
I tried an explain with no success:
#> EXPLAIN REFRESH MATERIALIZED VIEW test;
QUERY PLAN
-------------------------------------------
Utility statements have no plan structure
refresh
statement and checkpg_locks
: wiki.postgresql.org/wiki/Lock_Monitoring. Or just read the manual: postgresql.org/docs/current/static/… "could block other connections which are trying to read from the materialized view"