ANALYZE being a read v write operation clarification

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: abby(dot)e(dot)flint(at)gmail(dot)com
Subject: ANALYZE being a read v write operation clarification
Date: 2025-09-12 22:51:13
Message-ID: 175771747377.860.519892204627285536@wrigleys.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/sql-analyze.html
Description:

In the ANALYZE docs it states,
- "ANALYZE collects statistics about the contents of tables in the database,
and stores the results in the pg_statistic system catalog"
- "ANALYZE requires only a read lock on the target table".

When trying to determien if this command could be run with
`default_transaction_read_only` set to `on,` I was left stumped on whether
this is a read only or read-write operation. It is unclear to me, what
"stores" in the context of the "pg_statistic system catalog" means, and
whether that requires a write operation. I'm potentially missing
understanding on the workings of the `pg_statistic` system catalog, but
figured this could be a small improvement made to clarify the docs about
this operation.

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2025-09-13 00:55:14 Autocompletion for \sf does not work if there is more than one function
Previous Message Matheus Alcantara 2025-09-10 12:39:09 Re: Adding clarification on extension_control_path when extension is present in multiple folders