Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0f48-0000vx-6Y for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Oct 2017 02:42:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e0f47-0005Mz-Mj for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Oct 2017 02:42:11 +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 1e0f47-0005Mf-7u for pgsql-bugs@postgresql.org; Sat, 07 Oct 2017 02:42:11 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e0f44-0006E0-P6 for pgsql-bugs@postgresql.org; Sat, 07 Oct 2017 02:42:10 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A054020B56; Fri, 6 Oct 2017 22:42:07 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Fri, 06 Oct 2017 22:42:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=kyjWav6TMoTJN5O/7q wA7ilyjaE+mVa/UYsi/qbL8tU=; b=iI2/p9jjMMz+Ak8YUiv6kxP+ZvWlQwx/Jk CxeVsZ4qeRye3dsErK19sCtR6LNfeufZTITpsPkFsoZHB5mTVxX1YkPXLjlvAclW Rdu4n1qjxizRFx69npXB8o23x3qXVppWpB6IjXC8fDP7Fwzd3M+VKjLr4Noji0vn luacoujsOgEMvUjgawfzftHOAwPvNK8990naq3wXfjLNjeBHUBoGui1C0V61Ycm7 Z4TJVGQ1PeU0lHWGlpIyZw3f6LBVyHVYNJ4VsMK5gXhcETtYvtcuvoxh2ukJiuLp TIffR52q8B93+G9nbhCZ2zF0S98ptQhmg1SJ2RFVMK5pNS8M63iw== X-ME-Sender: X-Sasl-enc: IxILfqtJNTVpkYWJfFb/fhxLjtNa2+iq90Xo8jdrC4Vf 1507344127 Received: from intern.anarazel.de (unknown [136.24.76.72]) by mail.messagingengine.com (Postfix) with ESMTPA id 496137E3E0; Fri, 6 Oct 2017 22:42:07 -0400 (EDT) Date: Fri, 6 Oct 2017 19:42:05 -0700 From: Andres Freund To: Tom Lane Cc: Lucas Fairchild-Madar , pgsql-bugs@postgresql.org Subject: Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document Message-ID: <20171007024205.3p6idiqexbmik4cs@alap3.anarazel.de> References: <1546.1507314635@sss.pgh.pa.us> <2376.1507315734@sss.pgh.pa.us> <4514.1507318623@sss.pgh.pa.us> <20171007002116.2fqr6z26byhsjwoe@alap3.anarazel.de> <2219.1507336101@sss.pgh.pa.us> <20171007022633.kckfl2g7mnmtap2c@alap3.anarazel.de> <7739.1507343737@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7739.1507343737@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2017-10-06 22:35:37 -0400, Tom Lane wrote: > Andres Freund writes: > > I've just played around with this. ValuePerCall SRFs are fine with > > called in a short-lived context (they're required to be able to, as > > documented in xfunc.sgml), so is SFRM_Materialize. The only thing to be > > careful about is the *arguments* to the function, those need to live > > long enough in the ValuePerCall case. > > Isn't there already code to deal with that? See around line 175 > in execSRF.c. Well, that's for nodeFunctionscan.c, not nodeProjectSet.c. But it seems quite sensible to model this very similarly. I'd still like to unify those two functions, but given that ExecMakeTableFunctionResult materializes ValuePerCall SRFs, that doesn't seem likely. Greetings, Andres Freund -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs