Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f5eoa-00051A-6i for pgsql-committers@arkaria.postgresql.org; Mon, 09 Apr 2018 21:59:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f5eoX-0006at-VJ for pgsql-committers@arkaria.postgresql.org; Mon, 09 Apr 2018 21:59:01 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1f5eoX-0006ak-QB for pgsql-committers@lists.postgresql.org; Mon, 09 Apr 2018 21:59:01 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f5eoT-0008TB-8d for pgsql-committers@lists.postgresql.org; Mon, 09 Apr 2018 21:59:01 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id A2539122C; Mon, 9 Apr 2018 17:58:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 09 Apr 2018 17:58:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=ZS1M0sD4ZItXcto7i gDxGRKrfi8oPUpbek8u9JSaqFg=; b=TmlKR6lepEN8IE5A0ObituHvAoghmyv7a uq2J595IZ6vfWy6HK6fTdDubE3Yq6v+G3JcLDojoRBuComYUyV652QgW7srJVrsY iOt4bDI3xmi0znvYBhniFHEa3FhMVFZquCvSI31tHZmDCZddFxQ6SE4zUPliD+Ol 6WO2TPX2utQubz/2Igqe5CTm64ZRNRbp3ri5YlQcqVIr6kAADaaFphppQFTDpKkO Wy1C4+XZy/BTQEmcxdy1nV+rOYPoUlwhH3NYDcRFChug6vsUpob1jQTuTvv46u+m bGhLzK7Nf5l3kMR/35Pjiu5yqaCTqb+tKq64lpNdNZ++7ZKZ9ZpYQ== X-ME-Sender: Received: from alvin.alvh.no-ip.org (unknown [179.56.29.253]) by mail.messagingengine.com (Postfix) with ESMTPA id 35E15E5083; Mon, 9 Apr 2018 17:58:53 -0400 (EDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 4B7F3366; Mon, 9 Apr 2018 18:58:51 -0300 (-03) Date: Mon, 9 Apr 2018 18:58:51 -0300 From: Alvaro Herrera To: Andrew Gierth Cc: David Rowley , Tom Lane , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Support partition pruning at execution time Message-ID: <20180409215851.idwc75ct2bzi6tea@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="yrdnh3gccsltwmkd" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87k1tignsc.fsf@news-spur.riddles.org.uk> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --yrdnh3gccsltwmkd Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Andrew Gierth wrote: > >>>>> "Alvaro" == Alvaro Herrera writes: > > Alvaro> Thanks for cleaning that up. I'll look into why the test > Alvaro> (without this commit) fails with force_parallel_mode=regress > Alvaro> next week. > > Seems clear enough to me - the "Heap Fetches" statistic is kept in the > IndexOnlyScanState node in its own field, not part of ss.ps.instrument, > and is therefore not reported from workers to leader. Right, thanks for the pointer. So here's a patch that makes thing behave as expected. I noticed that instrument->nfiltered3 was available, so I used that to keep the counter. I wanted to print it using show_instrumentation_count (which has the nice property that you don't even have to test for es->analyze), but it doesn't work, because it divides the number by nloops, which is not what we want in this case. (It also doesn't print if the counter is zero, which maybe is desirable for the other counters but probably not for this one). I then noticed that support for nfiltered3 was incomplete; hence 0001. (I then noticed that nfiltered3 was added for MERGE. It looks wrong to me.) Frankly, I don't like this. I would rather have an instrument->ntuples2 rather than these "divide this by nloops, sometimes" schizoid counters. This is already being misused by ON CONFLICT (see "other_path" in show_modifytable_info). But it seems like a correct fix would require more code. Anyway, the partition_prune test works correctly now (after reverting AndrewSN's b47a86f5008f26) in both force_parallel_mode settings. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --yrdnh3gccsltwmkd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-print-nfiltered3.patch"