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 1ur1q8-00H4EH-IN for pgsql-general@arkaria.postgresql.org; Tue, 26 Aug 2025 22:08:29 +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 1ur1q7-00AhRW-MJ for pgsql-general@arkaria.postgresql.org; Tue, 26 Aug 2025 22:08:28 +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 1ur1q7-00AhRO-Bp for pgsql-general@lists.postgresql.org; Tue, 26 Aug 2025 22:08:27 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ur1q5-001uc8-1o for pgsql-general@lists.postgresql.org; Tue, 26 Aug 2025 22:08:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 57QM8Jbi1273427; Tue, 26 Aug 2025 18:08:20 -0400 From: Tom Lane To: Dimitrios Apostolou cc: pgsql-general@lists.postgresql.org Subject: Re: In-order pg_dump (or in-order COPY TO) In-reply-to: References: Comments: In-reply-to Dimitrios Apostolou message dated "Tue, 26 Aug 2025 21:43:44 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1273425.1756246099.1@sss.pgh.pa.us> Date: Tue, 26 Aug 2025 18:08:19 -0400 Message-ID: <1273426.1756246099@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dimitrios Apostolou writes: > Unfortunately after I did pg_restore to a new server, I notice that the > dumps from the new server are not being de-duplicated, all blocks are > considered new. > This means that the data has been significantly altered. The new dumps > contain the same rows but probably in very different order. Could the > row-order have changed when doing COPY FROM with pg_restore? I'd expect pg_dump/pg_restore to preserve the physical row ordering, simply because it doesn't do anything that would change that. However, restoring into an empty table would result in a table with minimal free space, whereas the original table probably had a meaningful amount of free space thanks to updates and deletes. Thus for example TIDs would not be the same. If your "rolling checksum" methodology is at all sensitive to page boundaries, the table would look quite different to it. regards, tom lane