Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uxZDX-00Fibf-Bw for pgsql-docs@arkaria.postgresql.org; Sat, 13 Sep 2025 22:59:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uxZDU-006io3-2b for pgsql-docs@arkaria.postgresql.org; Sat, 13 Sep 2025 22:59:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uxZDT-006inv-Lp for pgsql-docs@lists.postgresql.org; Sat, 13 Sep 2025 22:59:36 +0000 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uxZDR-000GCP-39 for pgsql-docs@lists.postgresql.org; Sat, 13 Sep 2025 22:59:35 +0000 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-6234b298d84so13535eaf.1 for ; Sat, 13 Sep 2025 15:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757804373; x=1758409173; darn=lists.postgresql.org; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=ClU9R9b7v8ZeU3EN9jsvNeSEacXpisKbLdVnPfjs+vc=; b=CLxnKR9JVc7ptx2R67DY8MOeCWe5K8ApOOW0pRP/AGCNPAKg+cVA0XHO288ozkJQ+a ErNAhLSL7Y7cHnvD/vcq8tSW8YuhTXQ78oL3kMx4WQmyZP64QVJLvwPS11ExA6HZtbvC KhsWgOD0Sp1S7G6b6JtAnrlJLwdNgTHkIroPf2ylOaIpRRE9Kysuc2+VcyjKgpmpzoHg uCPCaZ6RQ26f88v4uFSHLIQPytCqVdeZGoem76bYxhIGgz3vWLU4kP64bq5/UlSb5j5x nfc0L9IarCyRQnzWli8NsErap0lg5TmXhU4sQKkcWLzbcgmfFRMex2PcF+brs7Qbs8gK xgcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757804373; x=1758409173; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ClU9R9b7v8ZeU3EN9jsvNeSEacXpisKbLdVnPfjs+vc=; b=FRk5shUlR8qQTQM0sxOrVkvgTKFvBQOZdT14nc9D5K539GvWqZMIIEjmfqY5by39lI p/ReXU8ZRdWpMirgNU1D0WdhfVB1IVhFs3ZkiHyJwPkK5YpjE2MTQ0v0Hh9GV1y3NYl8 3b4uUKUabn12dwpqr4C+IojVDRybTIwOfACvOZhaEqKAoF24j3OP056kQ+Yd+VVP4FNs d7P2WSW+OqaY1mhltH+ftfE654+Y1XIjfQR6xrJIm7BN3shu0EzpWI+5Ctrl6xAfWpnD Ydj3HML666xQ1x3unksfiEeOiXkBW+RtFVgRhJUhk1hYIvSmnGFoQuUoKNfSUIi4dR3c 0KCA== X-Forwarded-Encrypted: i=1; AJvYcCVcxOc+fsTZzhFB5Sfm/qmNEEq2qUtgWnyyvbLz4c2BWgzyvsLDWoo4CUO5BWr85wgOlnJqo1NBTPMB@lists.postgresql.org X-Gm-Message-State: AOJu0YycfCwBR4jH5dw73jcOCDm80I9daLjj7CqKItwxX29qhjleJQUb s21RarGePtRShu8IgYJrCcVLwYo+67GgtBTnh0Yvl4f/6YIYAafI3OaGaDff/h9XFCBwtm+23KF uNVVZFCagPNgE/Fi2JtKp1Be1g5+s5ekG+g== X-Gm-Gg: ASbGnctKwzzn7rmcaN8YZtjjIRbXvrMfS4IKbk1jdFurmvcLrolf8lURQSaEy14mReS XkAeqX4z94GxHpSPPETSAoiDHSFcZ1o3J1C6+PhUWkyTpG1U7VClf8rfOxaAq8MF+r3vs85G+b0 9MqoC8bvaY79SxGSspWTPqBU0DalJZzGNY1NCMwXL++2cM8oSbLP0TT368rO9+BZIIF9zyFQAT9 8s7I57ZUcVuPCoh X-Google-Smtp-Source: AGHT+IE47yMXZhb6Yzpo2bTkkpqnIlG70OBVj4ZaS6l+8Zm2g/XJx2h/l/8u9PtsBOSAV/dbayl1wWUtbwWH5eGbLWE= X-Received: by 2002:a05:6820:516:b0:623:48b6:b4c with SMTP id 006d021491bc7-62348b60e92mr390779eaf.5.1757804372837; Sat, 13 Sep 2025 15:59:32 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6802:34ce:10b0:5df:b5f6:b71 with HTTP; Sat, 13 Sep 2025 15:59:32 -0700 (PDT) In-Reply-To: <175771747377.860.519892204627285536@wrigleys.postgresql.org> References: <175771747377.860.519892204627285536@wrigleys.postgresql.org> From: "David G. Johnston" Date: Sat, 13 Sep 2025 15:59:32 -0700 X-Gm-Features: Ac12FXy8dZ9oiasELUYogyqvFXKtw5n2GglePnb_GYYgH2cZ0RMeeDi7trY6PCM Message-ID: Subject: Re: ANALYZE being a read v write operation clarification To: "abby.e.flint@gmail.com" , "pgsql-docs@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000003a4982063eb6b91c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003a4982063eb6b91c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Friday, September 12, 2025, PG Doc comments form 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 whethe= r > 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. =E2=80=9Cstores the results in = the system catalog=E2=80=9D vs. =E2=80=9Cwrites the results to the system catal= og=E2=80=9D seems like a pure style choice. They mean the same thing. Though I=E2=80=99m probably = biased as a native English speaker. But I=E2=80=99d want some other opinions in f= avor of changing it before I=E2=80=99d try to go improve it. David J. --0000000000003a4982063eb6b91c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Friday, September 12, 2025, PG Doc comments form <noreply@postgresql.org> 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 dat= abase,
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 whe= ther
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&= quot; 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 i= t would be pretty useless since it has no output to the client.
<= br>
It reads the contents of the named table, computes statistics= , and then saves/stores/writes them for future reference - the location bei= ng saved to is a system catalog (a special kind of table).

If you want to propose a complete suggestion here it would be ente= rtained, but none of the terms seem problematic on their own. Though maybe = some requiring looking up if one is unfamiliar. =C2=A0=E2=80=9Cstores the r= esults in the system catalog=E2=80=9D vs. =E2=80=9Cwrites the results to th= e system catalog=E2=80=9D seems like a pure style choice.=C2=A0 They mean t= he same thing.=C2=A0 Though I=E2=80=99m probably biased as a native English= speaker.=C2=A0 But I=E2=80=99d want some other opinions in favor of changi= ng it before I=E2=80=99d try to go improve it.

Dav= id J.

--0000000000003a4982063eb6b91c--