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 1tzRRO-0021fM-6x for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 02:33:26 +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 1tzRRM-00F7C0-1q for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 02:33:24 +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 1tzRRL-00F7Br-LU for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 02:33:23 +0000 Received: from mail-yw1-x1131.google.com ([2607:f8b0:4864:20::1131]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tzRRJ-002feo-0E for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 02:33:23 +0000 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-6f47ed1f40dso35250807b3.1 for ; Mon, 31 Mar 2025 19:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743474799; x=1744079599; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TEtL4NPMjpusQFyDpTmtP128110n03PA0+LcKDtPBjE=; b=Ia9ivzyFuXxw6c+XeQDZa0nKMcaxsQybM1guvWhj23XhaerPE24c3Ux5j6kzuGoTCL JLahPU/mVuMH/cMPv8LUDyjeSIQoKOm+4pRyKLehgOKY7PM9TM7+pjirESwxqjgL8076 yDy7VGlvpMEeK8D8d5o8egSAmQ1U5ToalxPNlflrH6P9X9rHkrsAoJvG81Y1aizsIuVd sBgXOsGr7La8kwWe+NWFjE8/Za9eSBGFOvWRoOa3aTxVs7/KFHSPx1NLFFhdpND0ujWc vwJyrR4+A+oRTd0GxwFR+RMbe4FQ3j2CFE5onvI+tmPCQefht3lv9LEzpEyaFlOy1X37 AKjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743474799; x=1744079599; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TEtL4NPMjpusQFyDpTmtP128110n03PA0+LcKDtPBjE=; b=YJceHKEqUp9mlcNe6RgRgFzzr0xV8DEmUlsLGniqqhMO/1Mp0DmqitV4/z6ohdMGvM 2zp2LR/Jq/xa7OL9aQZb2NG++nhOgleH+lglC+TE43+r7WpNm/Iium1ub4xuvz5U4iwl vm4XFjXAJ+IiFS8/k2R14299gU5mLXDu51ydUuVmkto2aY+oSlZCs7+/6nOny1XUI/FL EZyrNVmhEVcQbbE25dUXAD93YbwgooAtiVf7p0FKLhWkcZFtrjPHDbVijjh4/MJZqpaR 2yiuUwBWFWE3tuWKKG7O4yM63RtLp2OOwaIae3NR+zoFMB4sPeBWyaJpXlieLgA0St/r 5D7A== X-Forwarded-Encrypted: i=1; AJvYcCXVavLZ7lyXMqI0RSNb+UO2kpUpMl+AG96u9Vqd/xkhGJZH5BAOs3iC49IJPl+syOpFFnqbPsGp2v78wnus@lists.postgresql.org X-Gm-Message-State: AOJu0Ywi131NPVv7kRNu+WRtN1EUfopP+HAfLgYzjEPGSWqfEEpMHPjl EDOGclvO8x2UIekkzHSXmeBjYcko7dwdOdFoiC7xgrq78gZqH3MA X-Gm-Gg: ASbGnctUqCaulLjlRHS/7PRRajm8qrVEZ/KxA6PIrwDPCcGQI/examELlZpqx3CgFo1 T8b4u/UtG/lSurzIkLw1gzuNLsn+UXM6/DQR0oz159aGDDl74E70yKSn/0y7Kmc7M90ADLoPLVx VQYS+NktOmEcapdwN2tTmM3RyuV0s0kJibF8tLfGraVeoqyFXtLx6Bkdy/6azBnO2224p/UjGbo w9HyCPm7JH+Sf9jpLvsXGwWx/unuhnCJH2MhbnDyYeI5MzYNvkECsP5yeKXSmL8F13ey8k56qCW EZ8LWQu/DL0jXNQphFoBR7i0pfImnl4PARKi6cm3avIhF2+f+J4VR//dm1Ew5fRN6CZoQAnSevn cxLFA/2AGFGWN8kPz8Xn3AGqY/jWqYSu1eiU= X-Google-Smtp-Source: AGHT+IHbyDc0ieHyeQfp6lMAgGbi8sl0mSN4IF9nP1D6IS9V/JkEY7iCEK56FcGQLlwCuM/N1Tu1Hg== X-Received: by 2002:a05:690c:dd5:b0:700:a655:47fd with SMTP id 00721157ae682-7025710de6amr154037517b3.19.1743474798742; Mon, 31 Mar 2025 19:33:18 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7023a98a0dcsm25113897b3.77.2025.03.31.19.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Mar 2025 19:33:17 -0700 (PDT) Date: Mon, 31 Mar 2025 21:33:15 -0500 From: Nathan Bossart To: Corey Huinker Cc: Jeff Davis , Robert Treat , Robert Haas , Andres Freund , Tom Lane , Michael Paquier , jian he , Bruce Momjian , Matthias van de Meent , Magnus Hagander , Stephen Frost , Ashutosh Bapat , Peter Smith , PostgreSQL Hackers , alvherre@alvh.no-ip.org Subject: Re: Statistics Import and Export Message-ID: References: <5812bf576f181e2f94944cab485cee46f611ed3e.camel@j-davis.com> <0576fa4dbd6e62e027b41e0ef9254896540f1cb4.camel@j-davis.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="z+otcOHbpmiudv4t" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --z+otcOHbpmiudv4t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Mar 31, 2025 at 11:11:47AM -0400, Corey Huinker wrote: > In light of v11-0001 being committed as 4694aedf63bf, I've rebased the > remaining patches. I spent the day preparing these for commit. A few notes: * I've added a new prerequisite patch that skips the second WriteToc() call for custom-format dumps that do not include data. After some testing and code analysis, I haven't identified any examples where this produces different output. This doesn't help much on its own, but it will become rather important when we move the attribute statistics queries to happen within WriteToc() in 0002. * I was a little worried about the correctness of 0002 for dumps that run the attribute statistics queries twice, but I couldn't identify any problems here either. * I removed a lot of miscellaneous refactoring that seemed unnecessary for these patches. Let's move that to another patch set and keep these as simple as possible. * I made a small adjustment to the TOC scan restarting logic in fetchAttributeStats(). Specifically, we now only allow the scan to restart once for custom-format dumps that include data. * While these patches help decrease pg_dump's memory footprint, I believe pg_restore still reads the entire TOC into memory. That's not this patch set's problem, but I think it's still an important consideration for the bigger picture. Regarding whether pg_dump should dump statistics by default, my current thinking is that it shouldn't, but I think we _should_ have pg_upgrade dump/restore statistics by default because that is arguably the most important use-case. This is more a gut feeling than anything, so I reserve the right to change my opinion. My goal is to commit the attached patches on Friday morning, but of course that is subject to change based on any feedback or objections that emerge in the meantime. -- nathan --z+otcOHbpmiudv4t Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v12n-0001-Skip-second-WriteToc-for-custom-format-dumps-wi.patch"