File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -923,7 +923,8 @@ ERROR: could not serialize access due to read/write dependencies among transact
923923
924924 <para>
925925 Acquired by <command>VACUUM</command> (without <option>FULL</option>),
926- <command>ANALYZE</>, <command>CREATE INDEX CONCURRENTLY</>, and
926+ <command>ANALYZE</>, <command>CREATE INDEX CONCURRENTLY</>,
927+ <command>CREATE STATISTICS</> and
927928 <command>ALTER TABLE VALIDATE</command> and other
928929 <command>ALTER TABLE</command> variants (for full details see
929930 <xref linkend="SQL-ALTERTABLE">).
Original file line number Diff line number Diff line change @@ -96,7 +96,13 @@ CreateStatistics(CreateStatsStmt *stmt)
9696 errmsg ("statistics \"%s\" already exist" , namestr )));
9797 }
9898
99- rel = heap_openrv (stmt -> relation , AccessExclusiveLock );
99+ /*
100+ * CREATE STATISTICS will influence future execution plans but does
101+ * not interfere with currently executing plans so it is safe to
102+ * take only ShareUpdateExclusiveLock on relation, conflicting with
103+ * ANALYZE and other DDL that sets statistical information.
104+ */
105+ rel = heap_openrv (stmt -> relation , ShareUpdateExclusiveLock );
100106 relid = RelationGetRelid (rel );
101107
102108 if (rel -> rd_rel -> relkind != RELKIND_RELATION &&
You can’t perform that action at this time.
0 commit comments