Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1crUaP-0001jt-PZ for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Mar 2017 19:09:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1crUaO-0005ro-Tm for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Mar 2017 19:09:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1crUYv-0003FF-9f for pgsql-hackers@postgresql.org; Fri, 24 Mar 2017 19:07:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1crUYo-0004tx-Av for pgsql-hackers@postgresql.org; Fri, 24 Mar 2017 19:07:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v2OJ7Smq007807; Fri, 24 Mar 2017 15:07:28 -0400 From: Tom Lane To: Andres Freund cc: Heikki Linnakangas , Tomas Vondra , pgsql-hackers@postgresql.org Subject: Re: WIP: Faster Expression Processing v4 In-reply-to: <20170324182742.3r4qndpugtx6ga3t@alap3.anarazel.de> References: <28270.1490289299@sss.pgh.pa.us> <20170323174004.a2ez7kygx5ngqxlp@alap3.anarazel.de> <8011.1490305255@sss.pgh.pa.us> <26088.1490315792@sss.pgh.pa.us> <20170324004734.3a2dokbfofiz6ylu@alap3.anarazel.de> <30270.1490318779@sss.pgh.pa.us> <20170324013412.qy7ltnnqv5m7qiuc@alap3.anarazel.de> <31825.1490320683@sss.pgh.pa.us> <20170324020003.4rt63xty7xpb4akq@alap3.anarazel.de> <22215.1490369187@sss.pgh.pa.us> <20170324182742.3r4qndpugtx6ga3t@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Fri, 24 Mar 2017 11:27:42 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7805.1490382448.1@sss.pgh.pa.us> Date: Fri, 24 Mar 2017 15:07:28 -0400 Message-ID: <7806.1490382448@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Andres Freund writes: > On 2017-03-24 11:26:27 -0400, Tom Lane wrote: >> Another modest proposal: >> >> I'm not really sold on the approach of using EEOP_FETCHSOME opcodes to >> trigger initial tupleslot de-forming. Certainly we want to have a single >> slot_getsomeattrs call per source slot, but as-is, we need a separate >> traversal over the expression tree just to precompute the max attribute >> number needed. That can't be good for expression compile speed, and >> it introduces nontrivial bug risks because the code that does that >> is completely decoupled from the code that emits the EEOP_VAR opcodes >> (which are what's really relying on the de-forming to have happened). > Hm. We had the separate traversal for projections for a long while, and > I don't think there've been a a lot of changes to the extraction of the > last attribute number. That's easily disproven just by looking at the code: /* * Don't examine the arguments or filters of Aggrefs or WindowFuncs, * because those do not represent expressions to be evaluated within the * calling expression's econtext. GroupingFunc arguments are never * evaluated at all. */ if (IsA(node, Aggref)) return false; if (IsA(node, WindowFunc)) return false; if (IsA(node, GroupingFunc)) return false; return expression_tree_walker(node, get_last_attnums_walker, (void *) info); The WindowFunc exception hasn't been there so long, and the GroupingFunc one is very new. And who's to say whether e.g. the recent XMLTABLE patch got this right at all? We could easily be extracting columns we don't need to. I'm willing to leave this as-is for the moment, but I really think we should look into changing it (after the main patch is in). regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers