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 1u0ATK-00DBQT-J2 for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Apr 2025 02:38: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 1u0ATJ-00227P-2u for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Apr 2025 02:38:25 +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 1u0ATI-00227H-Pc for pgsql-hackers@lists.postgresql.org; Thu, 03 Apr 2025 02:38:24 +0000 Received: from mail-yb1-xb2e.google.com ([2607:f8b0:4864:20::b2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u0ATH-002ek9-0I for pgsql-hackers@lists.postgresql.org; Thu, 03 Apr 2025 02:38:23 +0000 Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-e60b75f87aaso311622276.2 for ; Wed, 02 Apr 2025 19:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743647902; x=1744252702; 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=cRiOIF3wBGb4mGN6COVx433wJ1cR1aPMcQs8olc7BHk=; b=I2a6IJ7T0tyRQszFygIrjjj7bMB6ZnrsnBVlXMO27msNOlxNw2LFr+J5mQCDLT8qHq jbF28loeveGTS2YXDke8NVen+eJTPSiox465wwcIqCszrrwlhxKsDNztxfvZNNdwOUMw HxyX+W/6QqZuXu3EfR+XghgLRRt/bRVV1Esi36H8OVX0uDAdMh0kWzjdqHI5737YFAPh DlQQaXE1j4hKl4rx2WwXK9iBoAuy+Rpwlb+mA6g6ZtcG/CphFmokieCeLI5Vv9By3QAs 1770XFTUYC+6ZehCcIqWn/OuGKwgPvq+bq0cxnWqVbJX+oM6Nlr9492eRR8LmKrTxXxb tRTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743647902; x=1744252702; 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=cRiOIF3wBGb4mGN6COVx433wJ1cR1aPMcQs8olc7BHk=; b=Z+X8cIZ/SqgHmlCGcUBN2S54maRgRO8CFBzCp1oXRpEy1Xx8V92mf0ir3jsXnRGAAQ AfKumxeU9ZexXI9+Bcah82muqJixIWWI3dWwFUmL7RoYm4HrJ3KBF3aBbuMTGZP13sBv OuE6GGMrwI9LoQhaXpivlKy/C6md3HMfgB9esn+M+ivkE+A1B6Og9OzwZum5uVuoCZgB NKU1OrNH1O3wtxqrB7SAxMEFBmidgjLVpBdqu/h/jMLBjv9OBoWKZBaItyLEm5BVMZQw Ak2tKXNWduTShFvXUO5Bt9kZ6jJhWVPvnfyHiaFcf6KqmHdH+Rykd60i/86+f13oK42a w1kw== X-Forwarded-Encrypted: i=1; AJvYcCUNgcquKiUFOgAjQXYgrECMb5sPW1ZfaUFI5AwSaPKLE8qlsTtpfquBRdvgetIlSiNi9uoxYXt5d/QmQvpq@lists.postgresql.org X-Gm-Message-State: AOJu0Yy+8VHzLF51xremTcHO6WXZsHzdcew66mXEmHr6l3/WOVfUdyKS /XYHQfOswk2CeHej0nKn75j1i9BTR11tlGax/8md0rt3u3+T3/Zg X-Gm-Gg: ASbGnctNirPBIb7hMoTelqFnQLHfQGrQaXlN1F3EAej1CKK9CvRCA1M+CFWlPe8Mhs7 9fojhYKD7lFyO2lDYhOFI34Rgy5UxoNQzoRHw/qwdNQQa2WgUoMkZCXdqvYO7aDD67P8ZHeaStG ZppHIpxkOEZ/FMgtTLGn+vA5io3WQOpficpfXpM/8SIQCsMRil8n/g9an1Tpja64ekath8SQqkm 1FaEFUNU/COmMs9JDjaJq514KL9EGgTx6drI7gRZg77xt6CESQ9PSe+vT4WLYb+yl5TiiE4j8eu 2GpPorlmmDla97gQqwgYwZzXncfXL/8Jjlu7I7ylp0IYgdQJ8kCSC6Q95C7mkHXwzXQOWqxOQAY u0Z5VjI4bT4jiX3VrP02ZsR2GTJO1ZaUBNO4= X-Google-Smtp-Source: AGHT+IHdazUAK2tuz3+ar5UEkcwJ/5SmUbnTx40RirUVH3YftO78pU6Qh5OgOobWPzrBpiwXwdlI6g== X-Received: by 2002:a05:6902:2504:b0:e69:371d:5c82 with SMTP id 3f1490d57ef6-e6df449d259mr8781575276.8.1743647902089; Wed, 02 Apr 2025 19:38:22 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e6e0c8bcacasm82194276.2.2025.04.02.19.38.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Apr 2025 19:38:20 -0700 (PDT) Date: Wed, 2 Apr 2025 21:38:18 -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: <88af35fe0ff24cc4e0700b841aa60a0865f11648.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, Apr 02, 2025 at 10:34:58PM -0400, Corey Huinker wrote: >> >> > Also, why do we need the clause "WHERE s.tablename = ANY($2)"? Isn't >> > that already implied by "JOIN unnest($1, $2) ... s.tablename = >> > u.tablename"? >> >> Good question. Corey, do you recall why this was needed? >> > > In my patch, that SQL statement came with the comment: > > + /* > + * The results must be in the order of relations supplied in the > + * parameters to ensure that they are in sync with a walk of the TOC. > + * > + * The redundant (and incomplete) filter clause on s.tablename = ANY(...) > + * is a way to lead the query into using the index > + * pg_class_relname_nsp_index which in turn allows the planner to avoid an > + * expensive full scan of pg_stats. > + * > + * We may need to adjust this query for versions that are not so easily > + * led. > + */ Thanks. I included that in the latest patch set. -- nathan