X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00FA35331F for ; Tue, 19 Apr 2005 10:10:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69227-03 for ; Tue, 19 Apr 2005 13:10:23 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 145FE53E0F for ; Tue, 19 Apr 2005 08:26:06 -0300 (ADT) Received: (qmail 10381 invoked by uid 500); 19 Apr 2005 11:11:53 -0000 Date: Tue, 19 Apr 2005 06:11:53 -0500 From: Bruno Wolff III To: =?iso-8859-1?Q?K=D6PFERL?= Robert Cc: pgsql-sql@postgresql.org Subject: Re: can a function return a virtual table? Message-ID: <20050419111153.GA10314@wolff.to> Mail-Followup-To: Bruno Wolff III , =?iso-8859-1?Q?K=D6PFERL?= Robert , pgsql-sql@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/284 X-Sequence-Number: 21177 On Tue, Apr 19, 2005 at 09:34:43 +0200, KÖPFERL Robert wrote: > That was a nice answer - rather compleete. > > However at least I am questioning myself for a long time about what happens > if one does a select from a SRF. The function may return millions of records > (i.e. select * from x where a>1). Is this data streamed through the query > process or does postgres create a temporary table. > > An "explain select * from srf()" just returns a function invocation. :-/ > How does this work? If the function isn't written using a language of SQL, it isn't going to optimize well when you only want to see part of the table.