X-Original-To: pgsql-hackers-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 721D39FB30F for ; Sun, 30 Jul 2006 15:21:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 17233-06 for ; Sun, 30 Jul 2006 15:21:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from joeconway.com (joeconway.com [68.15.9.201]) by postgresql.org (Postfix) with ESMTP id 468879FB301 for ; Sun, 30 Jul 2006 15:21:37 -0300 (ADT) Received: from [192.168.4.40] (account jconway [192.168.4.40] verified) by joeconway.com (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 4130506; Sun, 30 Jul 2006 11:21:36 -0700 Message-ID: <44CCF8B0.5080406@joeconway.com> Date: Sun, 30 Jul 2006 11:21:36 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.13) Gecko/20060501 Fedora/1.7.13-1.1.fc5 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane CC: pgsql-hackers@postgresql.org Subject: Re: [PATCHES] 8.2 features? References: <200607281947.k6SJlOI02533@momjian.us> <473.1154116455@sss.pgh.pa.us> <44CA76A9.8070101@joeconway.com> <44CB051D.6090609@joeconway.com> <21320.1154222840@sss.pgh.pa.us> <26226.1154279741@sss.pgh.pa.us> In-Reply-To: <26226.1154279741@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.032 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200607/1551 X-Sequence-Number: 87406 Tom Lane wrote: > So what I'm currently thinking is > > 1. Implement ValuesScan. > 2. Convert all existing uses of Result without a child node into > ValuesScan. > 3. Rename Result to Filter and rip out whatever code is only used for > the no-child-node case. > > Steps 2 and 3 are just in the nature of housekeeping and can wait till > after the VALUES feature is in. Sounds good to me. > As far as avoiding overhead goes, here's what I'm thinking: > > * The Values RTE node should contain a list of lists of bare > expressions, without TargetEntry decoration (you probably do not > need ResTarget in the raw parse tree for VALUES, either). > > * The ValuesScan plan node will just reference this list-of-lists > (avoiding making a copy). It will need to contain a targetlist > because all plan nodes do, but the base version of that will just > be a trivial "Var 1", "Var 2", etc. (The planner might replace that > with a nontrivial targetlist in cases such as the example above.) I'll work on that today. > * At runtime, ValuesScan evaluates each sublist of expressions and > stores the results into a virtual tuple slot which is returned as > the "scan tuple" to execScan. If the targetlist is nontrivial then > it is evaluated with this tuple as input. If the targetlist is > a trivial Var list then the existing "physical tuple" optimization > kicks in and execScan will just return the scan tuple unmodified. > So for INSERT ... VALUES, the execScan layer will cost us nothing > in memory space and not much in execution time. > > There are still some things I don't like about the way you did > ValuesScan but I'll work on improving that. OK. Thanks, Joe