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 1tzcO8-004Kqv-8E for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 14:14:48 +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 1tzcO7-002yla-0H for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 14:14:47 +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 1tzcO6-002ylR-MW for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 14:14:46 +0000 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tzcO4-002M94-33 for pgsql-hackers@postgresql.org; Tue, 01 Apr 2025 14:14:45 +0000 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-30bfca745c7so49191691fa.0 for ; Tue, 01 Apr 2025 07:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743516883; x=1744121683; 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=j8IEWZE+IFLS9soOkaTTtJ2cV1p1yLTlmls6BOzMaYg=; b=d0yS0NsVlrC7N9RSE7M0hErrF2E9LXCrlMkli+tYQcEa36TREL6WI2vOZTUxT4VehD iocMa0JShAO28K1qZRNbuda8KbkMnl8aLa0zwlEUZnLZUNTyKjgUJJZQWpqKK0xPtgTP dAiIbbcjVHYix0ZEJdcOZSpQFy9AaZ3cEEwTrZTbm7MKkWvJcaq6DSTaZqWka/PCq3OW EKiNkvwj3tif7yQUdthyCsAYwv9scFtYR9G+DrjKo14jYZGVtMCiaMWCoIzLQwunsufu vv0TCZd6rfiTKhqp9mx9ldLYHolnJWv7yZczWtf3WfJ/FSPKcECANogTLL1bEnZuJg0r 8QMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743516883; x=1744121683; 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=j8IEWZE+IFLS9soOkaTTtJ2cV1p1yLTlmls6BOzMaYg=; b=fM5U5TCz8mfxFCYQoOBGsaKYYP71YgY8BR7W8teaP4VK27CKfMarUB71EYza+IOSZL r13uQs4lyCSKeJRIo2AkdqiHftb6gsQP5v3UqMJvtkQH2sEqgS27NCIK9BekJhAc0lfG Qmp0XOel+BqdauACV0jtW4AwhK5P3RD0oTA/l3KulSHKTdVrNul1eWyzy81S35wF08GW pxJbETFKCNmSci0JVXXMpkGy7OdoU+bo6anfWuS2sL//Hhuu5hT0lED9S9N7uP0RRiH4 XWDzTVe7wYNk7aw4d9c5PMefdpvwswVEmNttvqw7snV/st7+jTIcOecfZP01u0Aqz4ZN SRNg== X-Forwarded-Encrypted: i=1; AJvYcCXiHnCi5QsO2iVyALs6xp7PzfgjoMac+/4ty622jJIXUotNaDM8uBEtmL3SpYTLD+soRTyLtOXsK94CYawd@postgresql.org X-Gm-Message-State: AOJu0YzBdmsnz2Qmo3mQDCWQ3b7eG8861tZ0gqK8/DJ2A3w5LJO4MIcp ckHCjlKOhcQTK0aKrgMHUeMzVunloNhGaGj9/8cS8o/0jSaWt0f1c558Sinkn5acItbaTdANLjR BJJreQMOrqsMnh2TdoYmK/AlvttA= X-Gm-Gg: ASbGncu01VJcw37FsHGn7rPn/sr9wYQMw+h6QWvHmWlEFgM6UVjk8D3s0ypi5EFrZJH kAhPiwmp2JvzuF5ag/98xaAVh8bASrTtOCem/bVzJaq5tWqsNEBGl/TC5/fl1tWrEJNhOPLOmXT DKdRvn2g7pccHJsSSZ8Qot+CfkfrutRtp+Elxc3Q== X-Google-Smtp-Source: AGHT+IGZv6O2m9W4CrZ6rnEoT0U4+OPEo5T43FNhAxn3UVLhI8hDc+G2Gm/cnk1SY9wS3gk/l/6EdiSWdyj8WFf8lSM= X-Received: by 2002:a05:651c:144b:b0:30b:cc6a:ffe3 with SMTP id 38308e7fff4ca-30de022d9b1mr40891401fa.3.1743516883021; Tue, 01 Apr 2025 07:14:43 -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: Kirill Reshke Date: Tue, 1 Apr 2025 16:14:31 +0200 X-Gm-Features: AQ5f1JoF3jTK2hN2_tTaos6NT1gEVznbxAMyjud4UW8KRpS123uzoLTB9tamLwo Message-ID: Subject: Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query). To: vignesh C Cc: jian he , Fujii Masao , Andrew Dunstan , "David G. Johnston" , PostgreSQL-development , Tom Lane , Michael Paquier Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 1 Apr 2025 at 15:52, vignesh C wrote: > > On Tue, 1 Apr 2025 at 15:49, Kirill Reshke wrote: > > > > On Tue, 1 Apr 2025, 11:45 vignesh C, wrote: > >> > >> > >> One thing I noticed was that if the materialized view is not refreshed > >> user will get stale data > >> > >> Should we document this? > > > > Does this patch alter thus behaviour? User will get stale data even on HEAD, why should we take a care within this thread? > > 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? > This could prevent users from realizing the issue only after running > the copy operation, which would then require them to run it again. Yes, agree, +1 on that. > If > you think this is already obvious, then the note may not be necessary. I don't think this is already obvious, but my objection is that we should maybe discuss this as a separate issue (in a separate patch). Looks like fixing this together with code commit is too much at once. I prefer a one-commit-for-one-purpose style. > Regards, > Vignesh -- Best regards, Kirill Reshke