public inbox for [email protected]  
help / color / mirror / Atom feed
ANALYZE being a read v write operation clarification
2+ messages / 2 participants
[nested] [flat]

* ANALYZE being a read v write operation clarification
@ 2025-09-12 22:51 PG Doc comments form <[email protected]>
  2025-09-13 22:59 ` Re: ANALYZE being a read v write operation clarification David G. Johnston <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2025-09-12 22:51 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

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.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ANALYZE being a read v write operation clarification
  2025-09-12 22:51 ANALYZE being a read v write operation clarification PG Doc comments form <[email protected]>
@ 2025-09-13 22:59 ` David G. Johnston <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2025-09-13 22:59 UTC (permalink / raw)
  To: [email protected] <[email protected]>; [email protected] <[email protected]>

On Friday, September 12, 2025, PG Doc comments form <[email protected]>
wrote:

> 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.
>

Yes, it is a write operation - otherwise it would be pretty useless since
it has no output to the client.

It reads the contents of the named table, computes statistics, and then
saves/stores/writes them for future reference - the location being saved to
is a system catalog (a special kind of table).

If you want to propose a complete suggestion here it would be entertained,
but none of the terms seem problematic on their own. Though maybe some
requiring looking up if one is unfamiliar.  “stores the results in the
system catalog” vs. “writes the results to the system catalog” seems like a
pure style choice.  They mean the same thing.  Though I’m probably biased
as a native English speaker.  But I’d want some other opinions in favor of
changing it before I’d try to go improve it.

David J.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-09-13 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-09-12 22:51 ANALYZE being a read v write operation clarification PG Doc comments form <[email protected]>
2025-09-13 22:59 ` David G. Johnston <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox