Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxXMt-0006mY-Ha for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Aug 2019 14:01:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hxXMs-0003z7-5o for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Aug 2019 14:01:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxXMr-0003z0-Tn for pgsql-hackers@lists.postgresql.org; Tue, 13 Aug 2019 14:01:41 +0000 Received: from mail-qk1-x742.google.com ([2607:f8b0:4864:20::742]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxXMo-0007ou-P2 for pgsql-hackers@lists.postgresql.org; Tue, 13 Aug 2019 14:01:41 +0000 Received: by mail-qk1-x742.google.com with SMTP id u190so16046773qkh.5 for ; Tue, 13 Aug 2019 07:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=a2WktANB/w7omvVaaqU75jpjlD0jcmMX6wNTGYEYabI=; b=E/FE4YOKtjOkkYY/I2LJKj/lIaf2+42oNMpu2fgk26Xn5y1IdB+n8TsB1g3ktBDB1F P1ESZG6qn7ms/5KWIXZRe2fChF7gnE2Z8a1MvntEmeilzMUerO3aS+E3aCH96bA6P+b8 fBmw2aJjeSohM8Cvqu4pI19szOINjwsHB57y4WJ+ppaH9tbosWsP0FRJ/wYIkck+3Scq 9iXaWz2GqJt2BH/FjMAMg5f0lBwQHYNv9V3T6W9y6X8d+zxJ8QwxkbCjDaCcToVUWsNj qco6EznqtFWtkaCodlCN/ZqTde78kqcGRtWYKnP1L7ha2nRvxPNXmNVJ+4xZ0CgvW/UO sOKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=a2WktANB/w7omvVaaqU75jpjlD0jcmMX6wNTGYEYabI=; b=mP6a1pqjjoboaWHc9QjySrDUP1HQkQhm5ObWFVozm3P1rG3jfrA86aeQ7TOY27o6TC +6sdTlToEAH8btYmnl+I/9DQLv/cog9LHF+Rc5BDtGv5mDW7izznQkHaLn3mPMMlwlOj DogeeRbYN7mCLYR2XGAeCkGhlbzM34n+lKZ1HkMpLxbtKsI5yQ+1sRV+h8T2zG9X2d+c bJnYYwGlLCbiTD0IVNQGyiBrnZLLpHf7oFZebDNUvGoadp5OeFcfvFNdyXU/eYEvHJOv 7duYokHWjvyYFsgo2bwsU/qD+Dnk5mgwRfrKc2Fc7V9eMi7SgiL1O36+O9QyZRTzl+s2 qUAg== X-Gm-Message-State: APjAAAV7SfmFSoPyH8drAY9P6WxZVufGLSijLF3+jx7LXG2yeJZDpmrD ZpuXTmcuiL6VHD78POFUG5jby/YlOOOEtumMfgFvJOs0/2eebqbLMo/rfCuj91Bzq9P/O1UcGE6 xOnWY8/QwoN8+QXxZm23vB4FWDu2kY395gMuwcViLmYl+OwOFbj3yvXedShSQUW2gk+ihZ3lfEd Uku0pBJUAJ2DxJCBIz X-Google-Smtp-Source: APXvYqxxDj8ju1y9u8WDaXQuPagCmRFNtEJrMlI2jlb2YD4Rjam3REWdhQ8791qw5rZHFqkcwERn4w== X-Received: by 2002:a37:6c8:: with SMTP id 191mr35206243qkg.102.1565704895604; Tue, 13 Aug 2019 07:01:35 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([191.125.227.77]) by smtp.gmail.com with ESMTPSA id z186sm8344193qkb.2.2019.08.13.07.01.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 13 Aug 2019 07:01:34 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 964E2123B1B; Tue, 13 Aug 2019 10:01:27 -0400 (-04) Date: Tue, 13 Aug 2019 10:01:27 -0400 From: Alvaro Herrera To: Tatsuro Yamada Cc: Pg Hackers Subject: Re: progress report for ANALYZE Message-ID: <20190813140127.GA4933@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <45c2a6c0-80a1-0c55-b7d8-4ee15fd17841@nttcom.co.jp> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, On 2019-Jul-03, Tatsuro Yamada wrote: > My ex-colleague Vinayak created same patch in 2017 [1], and he > couldn't get commit because there are some reasons such as the > patch couldn't handle analyzing Foreign table. Therefore, I wonder > whether your patch is able to do that or not. > [1] ANALYZE command progress checker > https://www.postgresql.org/message-id/flat/968b4eda-2417-8b7b-d468-71643cf088b6%40openscg.com#574488592fcc9708c38fa44b0dae9006 So just now I went to check the jold thread (which I should have searched for before writing my own implementation!). It seems clear that many things are pretty similar in both patch, but I think for the most part they are similar just because the underlying infrastructure imposes a certain design already, rather than there being any actual copying. (To be perfectly clear: I didn't even know that this patch existed and I didn't grab any code from there to produce my v1.) However, you've now modified the patch from what I submitted and I'm wondering if you've taken any inspiration from Vinayak's old patch. If so, it seems fair to credit him as co-author in the commit message. It would be good to get his input on the current patch, though. I have not looked at the current version of the patch yet, but I intend to do so during the upcoming commitfest. Thanks for moving this forward! On the subject of FDW support: I did look into supporting that before submitting this. I think it's not academically difficult: just have the FDW's acquire_sample_rows callback invoke the update_param functions once in a while. Sadly, in practical terms it looks like postgres_fdw is quite stupid about ANALYZE (it scans the whole table??) so doing something that's actually useful may not be so easy. At least, we know the total relation size and maybe we can add the ctid column to the cursor in postgresAcquireSampleRowsFunc so that we have a current block number to report (becing careful about synchronized seqscans). I think this should *not* be part of the main ANALYZE-progress commit, though, because getting that properly sorted out is going to take some more time. I do wonder why doesn't postgres_fdw use TABLESAMPLE. I did not look at other FDWs at all, mind. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services