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 1tzc2n-004Fur-6Q for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 13:52:45 +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 1tzc2l-002ebZ-Ri for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 13:52:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzc2l-002ebR-IG for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 13:52:43 +0000 Received: from mail-yb1-xb2c.google.com ([2607:f8b0:4864:20::b2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tzc2j-002lGe-1O for pgsql-hackers@postgresql.org; Tue, 01 Apr 2025 13:52:43 +0000 Received: by mail-yb1-xb2c.google.com with SMTP id 3f1490d57ef6-e46ebe19368so4703189276.0 for ; Tue, 01 Apr 2025 06:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743515559; x=1744120359; 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=gNeHHiZMXHSbO10Ne9j1WqH70Cj0Z1imMLAHV+gz6IA=; b=l588NnX43t+edpidbBW1fI6U/7Z4p59K7svzfXnZXWb5pkEbTBqmRiBjdWdUd0lpnX rDqNxFuqnp00wKWce+BXo8OKMBrZo7GYXP+4g9n3pZYo1tV2Jwz8pLzqtoUR/bUVOwvI 8LxaHnyChBsAVZwn22/UoO8j/aR6LihkoXqchOF7WCPFuS8uIIIEbNmYD2pv4tf87K20 LWRHspVjbI/ardl9QeLi+NxkodGGkSvY/nBThn5r/Y4S2C8e3peXMd5yIGu7G6Ix9ePR JUHkUOHnBxy51wz7k3EMYEwaCiDXNNvrM4c2Kr0JY0FSxy7ErIECSkae98htf9YDB1Nf u+pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743515559; x=1744120359; 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=gNeHHiZMXHSbO10Ne9j1WqH70Cj0Z1imMLAHV+gz6IA=; b=PZMsR++Gpg+pajaLWAIwInxiPNB5uYPBvGV5scPhZlBJWJHgMMkvcZ961VzgANCQK1 xdJ71lOGGBtgb/cLEYEcbn5HNqi5Bozu/I7Dm8EZs2gjf7D9hUzaYM+i85Yr/b+MexdQ ht8/pKDp7HeRRE9o2GgIbp8DtA/OM0FqqbIn7Oo0E/OcOnxe2G/TZ3GB5scJEBBKrbsf v/b/84RLk6HmMHYtFUMndXd0BB3LQtAveTQyIGbwKpMeG2I82UGEyeK64blb9UcRFpl9 +PNwG6GhpwKP+Yaq++t6Cn1m2qthu+WY0Sfq2trTxf87W18o8lhLZxbz0+W21MuHJNnT V7Mg== X-Forwarded-Encrypted: i=1; AJvYcCV3SoUPj7rDs+npH8176dkPmMM6npekNMoEYvx1sRJmsTPnxsAwzmLNAYm98wANoqp7NgmrP+alELbNgVIn@postgresql.org X-Gm-Message-State: AOJu0Yx9j+m0gyjJdGJFUr3DlmFg02skAlpzUE5kULAFZGT53v1BjnxR SkZ2HXruBRGCT5YpQ2w+Yd41iqCUK4EgRLSFzgZc2Lri8ohdTGL7bLP8O1QaApHiEai24rpMd1O RL1KMM7245v3v9Pmg6arqPwor3JU= X-Gm-Gg: ASbGncvJeU8ws8Mi072INj/7V+a7S4PvGFxtFcXzAFeEIXgi5ceaS4FiMEahqMetq2Z pTeAAlGS77AWZEjx0XDsddbG2uP9OrK46ZNl3B+D1UECuPPX6bPwFaT3ApVUy/mQGeifZfFafIp 5Apg7ybhoBrporCeo1SPpTiyRGGAnYHujtp0mdD3YkJgpXQ+EnvXcHR9lUkJPw X-Google-Smtp-Source: AGHT+IHq+2xLzMFwiCxmqYFmHwdPB3LU/BL+gz0AHAbC6cs5lNWBa6ALBGt8YMX7G8hEY0XUzNexD/skl7bS110k1Nk= X-Received: by 2002:a05:690c:f13:b0:703:b278:db48 with SMTP id 00721157ae682-703b278ed66mr11980397b3.14.1743515559284; Tue, 01 Apr 2025 06:52:39 -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: vignesh C Date: Tue, 1 Apr 2025 19:22:27 +0530 X-Gm-Features: AQ5f1JpAnSsFkARXfSHWjZlpt5vaVnaMGKzN4F4Q3yE8DPHD30sHKL4kZ05kiJE Message-ID: Subject: Re: in BeginCopyTo make materialized view using COPY TO instead of COPY (query). To: Kirill Reshke 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: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. If you think this is already obvious, then the note may not be necessary. Regards, Vignesh