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 1f5wDa-0006oV-05 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Apr 2018 16:34:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f5wDZ-0007kR-7K for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Apr 2018 16:34: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 1f5w93-0004yM-Th for pgsql-hackers@lists.postgresql.org; Tue, 10 Apr 2018 16:29:22 +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 1f5w8z-0002Zv-Er for pgsql-hackers@lists.postgresql.org; Tue, 10 Apr 2018 16:29:21 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id A187012E9; Tue, 10 Apr 2018 12:29:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 10 Apr 2018 12:29:15 -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=JSQHcBku1EaQIppC/ 8cLxyBN5h07IEBdd2JNlmssrmA=; b=V1vRK28jz4KDtVTWrRHDkOoQlD0AjLBbI 0mCSkE480zNegWNTHvSrdt+StToBNPxIZOWhPbyYBHeKpcrraGjkZmc3OYz5gBnL y4hWKcvWTVkpOtPPNT57TyYpTl3w+SGe5RKBmxptAmNY75jx4V5ly5ZfCWdkftHe gdgWVdvKDj7LU2KGfY+J5eW4lB4FgxWxSJO2pVDhARf3PFeymb3ayFkz2EAbnjoc 0cZu+RE7QFjtZKAfsPbQmv1GmfMza4hlbAEW1zoIH1aShnDv0i586Umm8/6Rcfj4 v/8Z3E9qGqRTxfsGxIZO1QcIx2sExejSHgjgdKaDcYNxArFSX0vhA== X-ME-Sender: Received: from alvin.alvh.no-ip.org (unknown [179.56.29.253]) by mail.messagingengine.com (Postfix) with ESMTPA id B924E10255; Tue, 10 Apr 2018 12:29:14 -0400 (EDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id C415B764; Tue, 10 Apr 2018 13:29:12 -0300 (-03) Date: Tue, 10 Apr 2018 13:29:12 -0300 From: Alvaro Herrera To: Robert Haas Cc: Tom Lane , Andrew Gierth , David Rowley , PostgreSQL Hackers Subject: Re: pgsql: Support partition pruning at execution time Message-ID: <20180410162912.ungqwaqk53whnd33@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas wrote: > On Tue, Apr 10, 2018 at 11:14 AM, Alvaro Herrera > wrote: > > Questions: > > 1. Do we want to back-patch this to 10? I suppose (without checking) > > that EXPLAIN ANALYZE is already reporting bogus numbers for parallel > > index-only scans, so I think we should do that. > > I haven't looked at this closely, but have you considered adding > bespoke code for IndexOnlyScan that works like > ExecSortRetrieveInstrumentation and ExecHashRetrieveInstrumentation > already do rather than jamming this into struct Instrumentation? Thanks for pointing these out -- I hadn't come across these. My initial impression is that those two are about transferring instrumentation state that's quite a bit more complicated than what my patch proposes for indexonly scan, which is just a single integer counter. For example, in the case of Sort, for each worker we display separately the method and type and amount of memory. In the hash case, we aggregate all of them together for some reason (though I'm not clear about this one: /* * In a parallel-aware hash join, for now we report the * maximum peak memory reported by any worker. */ hinstrument.space_peak = Max(hinstrument.space_peak, worker_hi->space_peak); -- why shouldn't we sum these values?) In contrast, in an indexonly scan you have a single counter and it doesn't really matter the distribution of fetches done by workers, so it seems okay to aggregate them all in a single counter. And it being so simple, it seems reasonable to me to put it in Instrumentation rather than have a dedicated struct. > I'm inclined to view any node-specific instrumentation that's not > being pulled back to the leader as a rough edge to be filed down when > it bothers somebody more than an outright bug, but perhaps that is an > unduly lenient view. Still, if we take the view that it's an outright > bug, I suspect we find that there may be at least a few more of those. OK. As Tom indicated, it's not possible to backpatch this anyway. Given that nobody has complained to date, it seems okay to be lenient about this. Seeking a backpatchable solution seems more trouble than is worth. > I was pretty much oblivious to this problem during the initial > parallel query development and mistakenly assumed that bringing over > struct Instrumentation was good enough. It emerged late in the game > that this wasn't really the case, but holding up the whole feature > because some nodes might have details not reported on a per-worker > basis didn't really seem to make sense. Whether that was the right > call is obviously arguable. I certainly don't blame you for that. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services