Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pBThc-0007Ab-Ie for pgsql-hackers@arkaria.postgresql.org; Sat, 31 Dec 2022 04:42:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pBTha-0006BD-Ko for pgsql-hackers@arkaria.postgresql.org; Sat, 31 Dec 2022 04:42:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pBTha-0006B3-7g for pgsql-hackers@lists.postgresql.org; Sat, 31 Dec 2022 04:42:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pBThU-0005ET-Rr for pgsql-hackers@lists.postgresql.org; Sat, 31 Dec 2022 04:42:33 +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 2BV4gOT2951486; Fri, 30 Dec 2022 23:42:24 -0500 From: Tom Lane To: Tomas Vondra cc: James Finnerty , pgsql-hackers@lists.postgresql.org Subject: Re: postgres_fdw: using TABLESAMPLE to collect remote sample In-reply-to: <6da357b0-fdd3-095d-a06c-87666f4a5a8c@enterprisedb.com> References: <151e835f-55d6-ddbc-b5b4-07ee606aba44@enterprisedb.com> <03182011-10a4-97b4-7c70-d99aa1c11eed@enterprisedb.com> <167112207543.1120.12195641719862911275.pgcf@coridan.postgresql.org> <3377008.1671122816@sss.pgh.pa.us> <6da357b0-fdd3-095d-a06c-87666f4a5a8c@enterprisedb.com> Comments: In-reply-to Tomas Vondra message dated "Sat, 31 Dec 2022 00:03:08 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <951484.1672461744.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 30 Dec 2022 23:42:24 -0500 Message-ID: <951485.1672461744@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tomas Vondra writes: > After thinking about it a bit more I decided to rip out the 10% sampling > rate inflation. +1. I'm not sure if there's anything more we need to do there, but that didn't seem like that was it. I notice that the committed patch still has a reference to that hack though: + * Ensure the sampling rate is between 0.0 and 1.0, even after= the + * 10% adjustment above. (Clamping to 0.0 is just paranoia.) Clamping still seems like a wise idea, but the comment is just confusing now. Also, I wonder if there is any possibility of ANALYZE failing with ERROR: TABLESAMPLE clause can only be applied to tables and materialized = views I think the patch avoids that, but only accidentally, because reltuples will be 0 or -1 for a view. Maybe it'd be a good idea to pull back relkind along with reltuples, and check that too? regards, tom lane