X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 52DD7D1B501 for ; Mon, 20 Oct 2003 19:50:43 +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 95800-01 for ; Mon, 20 Oct 2003 16:50:13 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 45B7CD1B508 for ; Mon, 20 Oct 2003 16:50:11 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h9KJo0it013679; Mon, 20 Oct 2003 15:50:01 -0400 (EDT) To: Joe Conway Cc: josh@agliodbs.com, Richard Huxton , Michael Pohl , pgsql-sql@postgresql.org, "George A.J" Subject: Re: Which is faster SQL or PL/PGSQL In-reply-to: <3F942F72.6050709@joeconway.com> References: <200310201849.19668.dev@archonet.com> <3F942558.2000804@joeconway.com> <200310201124.02090.josh@agliodbs.com> <3F942F72.6050709@joeconway.com> Comments: In-reply-to Joe Conway message dated "Mon, 20 Oct 2003 11:54:42 -0700" Date: Mon, 20 Oct 2003 15:50:00 -0400 Message-ID: <13678.1066679400@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/255 X-Sequence-Number: 15655 Joe Conway writes: > Josh Berkus wrote: >> While we're on the topic, anyone know any good ways to speed up EXECUTE >> statements in PL/pgSQL functions? > Never tried it, but is it possible to use a prepared statement inside a > PL/pgSQL function? You could probably EXECUTE prepare and execute statements, but I don't see the point --- this would just be an extremely tedious way of duplicating plpgsql's normal query-plan-caching behavior. AFAICS, the whole point of EXECUTE in plpgsql is that it doesn't take any shortcuts, and so the answer to Josh's question can only be "don't use EXECUTE"... regards, tom lane