X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id AF5F0D1EBB9 for ; Fri, 2 Apr 2004 06:26:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 71041-03 for ; Fri, 2 Apr 2004 02:26:24 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 1A9C9D1EAAF for ; Fri, 2 Apr 2004 02:26:22 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i326QIDY023049; Fri, 2 Apr 2004 01:26:19 -0500 (EST) To: "Eduardo Naschenweng" Cc: pgsql-admin@postgresql.org Subject: Re: Does SETOF make queries slower? In-reply-to: <406C54C7.000001.00680@dgtat> References: <406C54C7.000001.00680@dgtat> Comments: In-reply-to "Eduardo Naschenweng" message dated "Thu, 01 Apr 2004 14:43:35 -0300" Date: Fri, 02 Apr 2004 01:26:18 -0500 Message-ID: <23048.1080887178@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/15 X-Sequence-Number: 12988 "Eduardo Naschenweng" writes: > bxs=3D# EXPLAIN ANALYZE SELECT dt_inicial, identidadea FROM cham_chamada cc= > ;=0D > [ is faster than ] > bxs=3D# EXPLAIN ANALYZE SELECT * FROM teste();=0D nodeFunctionscan.c insists on cramming the results of the function into a tuplestore and then reading them back. This is fairly expensive for a large result set. I complained about this back when the implementation was first proposed, but we set the problem aside for the time being, and it hasn't been revisited. One reason for it is that a function is by nature not very transparent, so it's hard to tell whether the storage overhead is necessary or not. regards, tom lane