Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query). - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).
Date
Msg-id CAKFQuwZQFhkOR4VAZoH_Hd0OhCJx-mHW4dRFk1R7phjemvjbbg@mail.gmail.com
Whole thread Raw
In response to Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query).  (vignesh C <vignesh21@gmail.com>)
List pgsql-hackers
On Tue, Apr 1, 2025 at 6:52 AM 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.  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.

pgsql-hackers by date:

Previous
From: Alena Rybakina
Date:
Subject: Re: Replace IN VALUES with ANY in WHERE clauses during optimization
Next
From: Peter Geoghegan
Date:
Subject: Re: Adding skip scan (including MDAM style range skip scan) to nbtree