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 1tq0AA-00FSBj-JD for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Mar 2025 01:36:38 +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 1tq0A9-00ByGA-7F for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Mar 2025 01:36:37 +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 1tq0A8-00ByCh-Sv for pgsql-hackers@lists.postgresql.org; Thu, 06 Mar 2025 01:36:36 +0000 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tq0A5-001Czw-0z for pgsql-hackers@lists.postgresql.org; Thu, 06 Mar 2025 01:36:36 +0000 Received: by mail-il1-x130.google.com with SMTP id e9e14a558f8ab-3d04932a36cso1711955ab.1 for ; Wed, 05 Mar 2025 17:36:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741224993; x=1741829793; 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=VidKnt0IiXORWijhEpFfbrhShvgeDx1zIekciY8CNfs=; b=jQtRjQsCVZffDDCQWuN5M9yibIk5XkGif0Xr9fkF0URLy3SckoxioTyhYuFkFnW/6h Vz4pu4kiYnbELW74MQyXRc53c9MrJ/6Dhl6WMdqyHtmIukx5mkct8TYiNHU9XPEkRACM G91bCE9wNWQY3Has0tOahjgXWe0D7JgU/UPRrToCogYIMsJraNkqPGcbK/71kWkx2EMQ OeNUb5ockMAs+tjcmWiUXFae3yZQlsw7VK8hqE1cRB3cJeOBO2y3gnB7XbadCZ2mK2Oy MJRWTe6wRhAY9oq+zayhS3kPijhFXLtQiMV+/m2RKyoxzfsB85hVfzBxRvumOFsNNeFz 1GLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741224993; x=1741829793; 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=VidKnt0IiXORWijhEpFfbrhShvgeDx1zIekciY8CNfs=; b=rgP2i4U5vfGiAS5W4AqUGDikOEABqy1K+59Ub+yMIrDfUsIA4O3cWby/GUWeCkT8Q4 /Re+l/7rMFlkgvNyVceQIiMDSJAz9Fhjh3AxKypYUJL6RWbE5B7dThp0TuFghbbYVgVB wxylNVemlvG7IzYuKsmvNLBtVy1VslRHFjXs3d0VLXgjTdEdw/h6DZv1cdKFLhjVsT/2 XlzlfluudrCq4Q4MDY49MHimgvgem0UJPRSWZ4otorw24JUEep+QgFeK8vVNmYd9AGWO cM6hfN3B4OmDYQpx/4iBNcFzQDMgm2RwV2UENQnvnw9KMIEIDCS0M+e1UzWTh8hSy8n8 TuIw== X-Forwarded-Encrypted: i=1; AJvYcCVOTxWBMkWcb2mNMnsUH6eQjQDVp1JvmBILu6OK0xLRSHLiE8sKjZh3LmeFHsudAOnBP8ikoWbspmLjae62@lists.postgresql.org X-Gm-Message-State: AOJu0YwuCEnUIAZ1LPSwtsPv4tAupIq6kwpzpfv60dFtuZY3BzwsNyi/ jZ/QuFFFYJ1dFn2arGq5ZIe04Z8NMJ5qftKAUa9rbxCg5rpoP9IXky5V4g== X-Gm-Gg: ASbGnctBWiE7OhoBwRPlc3GOLlh68dWeE6/KLct+uYJ+ctpMt5Q7LU0tYcOrs8vCacw jyHpBO7+U7IGm/kusNReTvX2mga3zFzbltA6Go3H3jCdMRYlG1rqVEegRYvbtGtiyrNPkA32+UH rNvxyfkRohG4A7ph8iVRhK52nAOUfk9lbo0wqmJXM6xpBNui5XylkeANsicy1XQudYAagx1IKty P+mKbEI5QgBGXzuMsc4fpCi/XgUkXRIA7tjP+42uJ+BeS79EJ6GjTv0r/prtNvRzDa9KNdxZX6R tilUB1bxPsfZpO9xHrHQW/qI8cmvSGaj1XftpF5yvWkZ1akv+bFd9Ftz6CyrSuqKEAn12hwxssY VM9h3mZimRUKR3i5bav157Io4MuCdhpkLJ9g= X-Google-Smtp-Source: AGHT+IEZoaW/hCRzUGVY+1er/m78OeYgoUb3ybURY5nPOEKXMFaoZOc1HF028LVFvEBHH507w6xbPQ== X-Received: by 2002:a05:6e02:194c:b0:3cf:c9ad:46a1 with SMTP id e9e14a558f8ab-3d42b8d2353mr61887385ab.13.1741224992825; Wed, 05 Mar 2025 17:36:32 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3d43b510303sm330155ab.41.2025.03.05.17.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 17:36:32 -0800 (PST) Date: Wed, 5 Mar 2025 19:36:29 -0600 From: Nathan Bossart To: Andres Freund Cc: Corey Huinker , Jeff Davis , 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: <3728741.1740178078@sss.pgh.pa.us> <97b451228227c555be1a4f79c4a62ddec9a74f06.camel@j-davis.com> <6af48508a32499a8be3398cafffd29fb6188c44b.camel@j-davis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 05, 2025 at 08:17:53PM -0500, Andres Freund wrote: > Right now --statistics more than doubles the number of queries that pg_dump > issues. That's oviously noticeable locally, but it's going to be really > noticeable when dumping across the network. > > I think we need to do more to lessen the impact. Even leaving regression test > performance aside, the time increase for the default pg_dump invocation will > be painful for folks, particularly due to this being enabled by default. > > One fairly easy win would be to stop issuing getAttributeStats() for > non-expression indexes. In most cases that'll already drastically cut down on > the extra queries. Apologies if this has already been considered upthread, but would it be possible to use one query to gather all the required information into a sorted table? At a glance, it looks to me like it might be feasible. I had a lot of luck with reducing the number per-object queries with that approach recently (e.g., commit 2329cad). -- nathan