pg.ddx.io pgsql-docs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
Required locks for ANALYZE 4+ messages / 4 participants [nested] [flat]
* Required locks for ANALYZE @ 2019-08-20 07:47 PG Doc comments form <noreply@postgresql.org> 2019-08-20 14:12 ` Re: Required locks for ANALYZE Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 4+ messages in thread From: PG Doc comments form @ 2019-08-20 07:47 UTC (permalink / raw) To: pgsql-docs@lists.postgresql.org; +Cc: zyake.mk4@gmail.com The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/9.5/sql-select.html Description: The below document says that the ANALYZE statement requires a read lock. https://www.postgresql.org/docs/current/sql-analyze.html ----- ANALYZE requires only a read lock on the target table, so it can run in parallel with other activity on the table. ----- But it is too vague as there is no such table level lock. In addition, the document explains the SHARE UPDATE EXCLUSIVE table lock obtained by ANALYZE. https://www.postgresql.org/docs/current/explicit-locking.html ----- SHARE UPDATE EXCLUSIVE Conflicts with the SHARE UPDATE EXCLUSIVE, SHARE, SHARE ROW EXCLUSIVE, EXCLUSIVE, and ACCESS EXCLUSIVE lock modes. This mode protects a table against concurrent schema changes and VACUUM runs. Acquired by VACUUM (without FULL), ANALYZE, CREATE INDEX CONCURRENTLY, CREATE STATISTICS and ALTER TABLE VALIDATE and other ALTER TABLE variants (for full details see ALTER TABLE). ----- Therefore, in my opinion, the below paragraph should be amended as below. * Before ----- ANALYZE requires only a read lock on the target table, so it can run in parallel with other activity on the table. ----- * After ----- ANALYZE requires only a SHARE UPDATE EXCLUSIVE lock on the target table, so it can run in parallel with queries requiring ACCESS SHARE/ROW SHARE/ROW EXCLUSIVE locks such as SELECT, UPDATE, DELETE, INSERT on the table. ----- ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Required locks for ANALYZE 2019-08-20 07:47 Required locks for ANALYZE PG Doc comments form <noreply@postgresql.org> @ 2019-08-20 14:12 ` Tom Lane <tgl@sss.pgh.pa.us> 2019-09-30 07:46 ` RE: Required locks for ANALYZE Aramaki Zyake <zyake.mk4@gmail.com> 0 siblings, 1 reply; 4+ messages in thread From: Tom Lane @ 2019-08-20 14:12 UTC (permalink / raw) To: zyake.mk4@gmail.com; +Cc: pgsql-docs@lists.postgresql.org PG Doc comments form <noreply@postgresql.org> writes: > Therefore, in my opinion, the below paragraph should be amended as below. > * Before > ----- > ANALYZE requires only a read lock on the target table, so it can run in > parallel with other activity on the table. > ----- > * After > ----- > ANALYZE requires only a SHARE UPDATE EXCLUSIVE lock on the target table, so > it can run in parallel with queries requiring ACCESS SHARE/ROW SHARE/ROW > EXCLUSIVE locks such as SELECT, UPDATE, DELETE, INSERT on the table. > ----- This does not really seem like an improvement. The second formulation is pedantically correct, but also unintelligible. Maybe we could make it say "run in parallel with non-DDL activity" ? regards, tom lane ^ permalink raw reply [nested|flat] 4+ messages in thread
* RE: Required locks for ANALYZE 2019-08-20 07:47 Required locks for ANALYZE PG Doc comments form <noreply@postgresql.org> 2019-08-20 14:12 ` Re: Required locks for ANALYZE Tom Lane <tgl@sss.pgh.pa.us> @ 2019-09-30 07:46 ` Aramaki Zyake <zyake.mk4@gmail.com> 2023-11-08 21:06 ` Re: Required locks for ANALYZE Bruce Momjian <bruce@momjian.us> 0 siblings, 1 reply; 4+ messages in thread From: Aramaki Zyake @ 2019-09-30 07:46 UTC (permalink / raw) To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org> Hi, I’m terribly sorry for the delay of response. >This does not really seem like an improvement. The second formulation is >pedantically correct, but also unintelligible. > > Maybe we could make it say "run in parallel with non-DDL activity" ? I completely agree with you, therefore, I amended it as follows. ---- ANALYZE requires only a read lock on the target table, so it can run in parallel with non-DDL activity on the table. ---- Would it be possible to proceed further? Best regards From: Tom Lane Sent: Tuesday, August 20, 2019 11:12 PM To: zyake.mk4@gmail.com Cc: pgsql-docs@lists.postgresql.org Subject: Re: Required locks for ANALYZE PG Doc comments form <noreply@postgresql.org> writes: > Therefore, in my opinion, the below paragraph should be amended as below. > * Before > ----- > ANALYZE requires only a read lock on the target table, so it can run in > parallel with other activity on the table. > ----- > * After > ----- > ANALYZE requires only a SHARE UPDATE EXCLUSIVE lock on the target table, so > it can run in parallel with queries requiring ACCESS SHARE/ROW SHARE/ROW > EXCLUSIVE locks such as SELECT, UPDATE, DELETE, INSERT on the table. > ----- This does not really seem like an improvement. The second formulation is pedantically correct, but also unintelligible. Maybe we could make it say "run in parallel with non-DDL activity" ? regards, tom lane ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Required locks for ANALYZE 2019-08-20 07:47 Required locks for ANALYZE PG Doc comments form <noreply@postgresql.org> 2019-08-20 14:12 ` Re: Required locks for ANALYZE Tom Lane <tgl@sss.pgh.pa.us> 2019-09-30 07:46 ` RE: Required locks for ANALYZE Aramaki Zyake <zyake.mk4@gmail.com> @ 2023-11-08 21:06 ` Bruce Momjian <bruce@momjian.us> 0 siblings, 0 replies; 4+ messages in thread From: Bruce Momjian @ 2023-11-08 21:06 UTC (permalink / raw) To: Aramaki Zyake <zyake.mk4@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org> On Mon, Sep 30, 2019 at 04:46:56PM +0900, Aramaki Zyake wrote: > Hi, > > I’m terribly sorry for the delay of response. > > > > >This does not really seem like an improvement. The second formulation is > > >pedantically correct, but also unintelligible. > > > > > > Maybe we could make it say "run in parallel with non-DDL activity" ? > > > > I completely agree with you, therefore, I amended it as follows. > > ---- > > ANALYZE requires only a read lock on the target table, so it can run in > > parallel with non-DDL activity on the table. I know this report is four years old, but attached patch applied to master. -- Bruce Momjian <bruce@momjian.us> https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. Attachments: [text/x-diff] analyze.diff (517B, ../../ZUv4Ytt-vVMSLrb8@momjian.us/2-analyze.diff) download | inline diff: diff --git a/doc/src/sgml/ref/analyze.sgml b/doc/src/sgml/ref/analyze.sgml index 4c79a01eb6..6ed8e7241b 100644 --- a/doc/src/sgml/ref/analyze.sgml +++ b/doc/src/sgml/ref/analyze.sgml @@ -208,7 +208,7 @@ ANALYZE [ ( <replaceable class="parameter">option</replaceable> [, ...] ) ] [ <r <para> <command>ANALYZE</command> requires only a read lock on the target table, so it can run in - parallel with other activity on the table. + parallel with other non-DDL activity on the table. </para> <para> ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2023-11-08 21:06 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-08-20 07:47 Required locks for ANALYZE PG Doc comments form <noreply@postgresql.org> 2019-08-20 14:12 ` Tom Lane <tgl@sss.pgh.pa.us> 2019-09-30 07:46 ` Aramaki Zyake <zyake.mk4@gmail.com> 2023-11-08 21:06 ` Bruce Momjian <bruce@momjian.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox