Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 1094B2E3E3C for ; Tue, 8 Jan 2008 23:33:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 95060-03 for ; Tue, 8 Jan 2008 23:33:34 -0400 (AST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.243]) by postgresql.org (Postfix) with ESMTP id DA0582E3E18 for ; Tue, 8 Jan 2008 23:33:34 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c36so20626ana.33 for ; Tue, 08 Jan 2008 19:33:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=wlM0gSV/EEJHInftmeBSRfDfFfA6o0PV1lrwMlY+N2s=; b=xP2ebNVn1FuVr4ALITVec1s+MB86Z74bLmQwazmnrxPap4WnhaUGObdenDK1Ifalchgn0PiIwWB2BDglz/zLKFVv6VUkpirEO1Qy7caE++IG4xaGs+WDOd5kX7V614c7F8LrxsWZyPpGTnm+etKu7UWbFc1Im7UmAVIUNNR+ogk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=kawZXzpg46JKbUkSAO8OZ6/Re9wlEHupfu4cut59eM0AdUqTgnFERuatEsHcVf2Xwq5ChnRQABXidqhfQ7BuWa4qcofYdF50owEUZrBmuDIf6pPs+UYJRZ2Yj8YSs2W2ckk6U2UcZHV+8Qeh0lsNU/4u69tq/keNXhN54r0/Q4g= Received: by 10.100.254.18 with SMTP id b18mr443927ani.57.1199849613215; Tue, 08 Jan 2008 19:33:33 -0800 (PST) Received: by 10.100.95.16 with HTTP; Tue, 8 Jan 2008 19:33:33 -0800 (PST) Message-ID: Date: Tue, 8 Jan 2008 19:33:33 -0800 From: "John Smith" To: "Tom Lane" Subject: Re: Performance of aggregates over set-returning functions Cc: pgsql-performance@postgresql.org In-Reply-To: <25214.1199848043@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <25214.1199848043@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/31 X-Sequence-Number: 28270 > > Interestingly though, when the range in the generate_series() was > > small enough to fit in 4 bytes of memory (e.g. > > generate_series(1,1000000000) ), the above query completed consuming > > only negligible amount of memory. So, it looked like the aggregate > > computation was being pipelined with the tuples returned from > > generate_series(). > > It's pipelined either way. But int8 is a pass-by-reference data type, > and it sounds like we have a memory leak for this case. Thanks for your reply. How easy is it to fix this? Which portion of the code should we look to change? - John