Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHLsP-0000Ne-BW for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Jun 2016 02:02:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bHLsN-0003gD-AV for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Jun 2016 02:02:15 +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.84_2) (envelope-from ) id 1bHLsL-0003g4-HV for pgsql-hackers@postgresql.org; Mon, 27 Jun 2016 02:02:13 +0000 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bHLsD-0001Hs-F0 for pgsql-hackers@postgresql.org; Mon, 27 Jun 2016 02:02:12 +0000 Received: by mail-pf0-x235.google.com with SMTP id h14so56554596pfe.1 for ; Sun, 26 Jun 2016 19:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ET1xQfv8ruWp6PdwV6cHPu4935rMif5QX48hnbi9exQ=; b=Zozr0jz9w2d/c/ip0Z/cWnDK9acgaj/Y4kMKCK5j5rGKm3T0q0s9AzFDXkffjK9swL SkH1OJ9dv89QmjCLSqV0QEhfojy0npzYBUUpbNvvCz7Y+PsyvUnBDhUxWPbCQznBokeJ LfKfbnI2ffmynPwyuBTv4xMR44lTz6w1LKx+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ET1xQfv8ruWp6PdwV6cHPu4935rMif5QX48hnbi9exQ=; b=mnX+pW4qRZqmXGgSfSLbPTp9vucU/GupSEGUS3EAct9+oHTP5bYHgSrfKZatsdvilm 6CRzJOUhZ3hw1ri58DDFunYLYyjeuojfpkX8/eHCeTcIFj61/IYeJm/1zfzp3FJzCmQe mQKwxJiR5EMODiFDQ9T4Cg01whBTOyZAHUHOy/Epggq8irIzZn3DuPGoqjDZZoGObl1f 2NuixjEEYzOYYHCljW0+EucBIEJxODC0ZaeVETjjTljC71l0++h2vT4yJbDiZSGoPX0w UYQszBkSXqGwGOUJ39oMroecOhGUbTYZuHFpxyv8LqRt6Smkuku4FBSUzLi+r7sRcsz5 Uqcg== X-Gm-Message-State: ALyK8tL6Kfm7MkZfN7A3nTU0vFzV0zwUi2bQVlc2E41K1MtZzIOtCavgBKLnxxqH6jEeIw== X-Received: by 10.98.46.70 with SMTP id u67mr28234467pfu.134.1466992921977; Sun, 26 Jun 2016 19:02:01 -0700 (PDT) Received: from tornado.leadboat.com (c-98-248-47-228.hsd1.ca.comcast.net. [98.248.47.228]) by smtp.gmail.com with ESMTPSA id d65sm2373353pfa.45.2016.06.26.19.02.00 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 26 Jun 2016 19:02:00 -0700 (PDT) Date: Sun, 26 Jun 2016 22:01:58 -0400 From: Noah Misch To: Tom Lane Cc: David Rowley , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: Parallelized polymorphic aggs, and aggtype vs aggoutputtype Message-ID: <20160627020158.GA1319154@tornado.leadboat.com> References: <14538.1466116810@sss.pgh.pa.us> <22037.1466129876@sss.pgh.pa.us> <27247.1466185504@sss.pgh.pa.us> <10050.1466637736@sss.pgh.pa.us> <18443.1466693846@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18443.1466693846@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) X-Pg-Spam-Score: -2.7 (--) 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 On Thu, Jun 23, 2016 at 10:57:26AM -0400, Tom Lane wrote: > David Rowley writes: > > On 23 June 2016 at 11:22, Tom Lane wrote: > >> The behavior that I'd expect (and that I documented) for a deserialization > >> function is that it just allocates its result in the current, short-lived > >> memory context, since it will be the combine function's responsibility to > >> merge that into the long-lived transition state. But it looks to me like > >> the deserialization functions in numeric.c are allocating their results > >> in the aggregate context, which will mean a leak. (For example, > >> numeric_avg_deserialize creates its result using makeNumericAggState > >> which forces the result into the agg context.) > > > Yes, you're right. > > > In the end I decided to add a makeNumericAggStateCurrentContext() > > function which does not perform any memory context switching at all. > > It seems like this can be used for the combine functions too, since > > they've already switched to the aggregate memory context. This should > > save a few cycles during aggregate combine, and not expend any extra > > as some alternatives, like adding a flag to makeNumericAggState(). > > You missed the ones using makePolyNumAggState --- I fixed that and > pushed it. What, if anything, is yet required to close this 9.6 open item? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers