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 1tzcaz-004Nir-Ll for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 14:28:05 +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 1tzcay-003AB6-BN for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 14:28:04 +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 1tzcay-003AAm-0G for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 14:28:04 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tzcaw-002MGr-0v for pgsql-hackers@postgresql.org; Tue, 01 Apr 2025 14:28:03 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-72bbd3a3928so3102250a34.2 for ; Tue, 01 Apr 2025 07:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743517681; x=1744122481; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DsxbG5+QcR7lsHqovh5g2Lnvr2qOSxxb0ha4M+vdEbo=; b=cszfh6K0f0GH7R+sF57FQaAK3oTNl/N3j9GKprkxgXVjYFFMBgYUimoIrDJ/SGUBvY GADrfaCoIK3HjokWQBWoIQJ4OH+lfpxP0BcC2/EWvdNX1aB+XvXFX/D2GXaD1v/shfkV x1AqLqnGmNfW+POzSJoVtqSbwOFwCp9IGGuSHDynVIGw5FfgMsFxl68OsiUqffv0QOCe 3Rgyhe/XV6L9RkpwUV+a38c0ArB6D8H72vYN/X5ft715ZWkqwsvQQvPwEBGTpF7U/wv6 6gBSCJnzNoe/qRR0KQ1iyq1Pt14rsS4oFj6dqyTf6Okh6MWs3bHMh2G0Y1vC+3qdoc/R xzIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743517681; x=1744122481; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DsxbG5+QcR7lsHqovh5g2Lnvr2qOSxxb0ha4M+vdEbo=; b=xFqiqEVneOlTuuQ9k/1I0yiEy5wgp6RTwlb5Xyl1IVHY/yvjj8KOn6ejYJwxxZ064A U4fuiuktMC/1HnNJUXdPmkIWoVJ9ekC49b34t+RcsPBaY8RbWeQsImNQNPpaKhIMrGb2 1gknjfNF4S6e7KYi4vIuRjMc0RHjAVu6ZqNFUmI9FDr6CaK7S9iJrcWoLcYXwDcsdgbb 6JtTMGX/PJGRDajdlUukn+DiV3fp8Y00l9N6tSVMd18pohQJyP/MLRRxwj4/oT4758ov ts444lMQK0egRLnG7aSWE33oGzfdldZ0KHjgIQwUk+pDxSrvjuVp74jmX5NMkGWXYhXk CUDg== X-Forwarded-Encrypted: i=1; AJvYcCW/M/XZ2RdgAW7iK33ERl9pJf9uZlzSK0wENeqOodQt0511qvhiK4o58YB8iPh+2SWDIqIA9K2lQ71qyqIz@postgresql.org X-Gm-Message-State: AOJu0YxxXZqcdx6O/rUsmp3Ck7jzceERNcQdU5pEd9I+5k+c39ll3G/0 c5Q0x7eSf8NEdXHeE17vr7RakDzN1HPd/YRTcrFyMuNi/Qenv27RfAMs6h5layBNrSQTbeZ2LVT GMLrxYYEnbhrDAWpG+krUD4FvmwZwXsTb X-Gm-Gg: ASbGncsPu/oUZfWSNJaSpXFF6Jpb+R7KW1F27M4u55YcqleqyHCDbdMDDvQN2PgWejr I6AcSn7gn4XDqi93t4nZJpVgooJsg/zH6I6unr3aP/EWI/koBuqfPfE3k0bChlJiO052lw2eg62 qjEs4Ae6xR1ahnBUWEdqWbfsm9 X-Google-Smtp-Source: AGHT+IGawu9jw9dVBEJO/JEpDTvowsY89s4NKg/F9vb5gGIRmDg0bXDDKYttbOdVHX7c8kbcMKtIHy7OsHsoA9Qcl1c= X-Received: by 2002:a05:6830:6f0e:b0:72b:a6a9:8465 with SMTP id 46e09a7af769-72c6383aa8dmr8169509a34.23.1743517681465; Tue, 01 Apr 2025 07:28:01 -0700 (PDT) MIME-Version: 1.0 References: <442e62f7-ef64-4df1-8453-d682fe9bdaa3@dunslane.net> <425ebe4b-06c5-4212-af68-fd0e5537c250@dunslane.net> In-Reply-To: From: "David G. Johnston" Date: Tue, 1 Apr 2025 07:27:24 -0700 X-Gm-Features: AQ5f1Jq96azYE7S9MGZdRCy9duBq8S18PLU0KVXdj_MWV-Qkzkdc87zuZRyFhFs Message-ID: Subject: Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query). To: vignesh C Cc: Kirill Reshke , jian he , Fujii Masao , Andrew Dunstan , PostgreSQL-development , Tom Lane , Michael Paquier Content-Type: multipart/alternative; boundary="0000000000001040880631b8587e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001040880631b8587e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 1, 2025 at 6:52=E2=80=AFAM vignesh C wrot= e: > > We are not changing the existing behavior. However, since copying data > from large tables can take a significant amount of time, would it be > helpful to add a cautionary note advising users to refresh the > materialized view before running copy command to avoid stale data? > > No, for the same reason the caveat about WITH NO DATA need not be mentioned either. These are the inherent properties/trade-offs of using a materialized view versus a normal view. They are discussed when talking about the creation and usage of materialized views specifically. Features that interact with materialized views consistent with these two documented properties do not need to point out that fact. i.e., the existing non-documenting of those two points in SELECT is appropriate, and should be emulated in COPY. The output doesn't change if you write "copy table" instead of "copy (select * from table)" so nothing needs to be pointed out. David J. --0000000000001040880631b8587e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Apr 1, 2025 at 6:52=E2=80=AFAM vignesh C <vignesh21@gmail.com> wrote:=

We are not changing the existing behavior. However, since copying data
from large tables can take a significant amount of time, would it be
helpful to add a cautionary note advising users to refresh the
materialized view before running copy command to avoid stale data?


No, for the same reason the caveat about= WITH NO DATA need not be mentioned either.=C2=A0 These are the inherent pr= operties/trade-offs of using a materialized view versus a normal view.=C2= =A0 They are discussed when talking about the creation and usage of materia= lized views specifically.=C2=A0 Features that interact with materialized vi= ews consistent with these two documented properties do not need to point ou= t that fact. i.e., the existing non-documenting of those two points in SELE= CT is appropriate, and should be emulated in COPY.=C2=A0 The output doesn&#= 39;t change if you write "copy table" instead of "copy (sele= ct * from table)" so nothing needs to be pointed out.

David J.

--0000000000001040880631b8587e--