Re: SQL Function Performance - Mailing list pgsql-performance

From Michael Fuhr
Subject Re: SQL Function Performance
Date
Msg-id 20060214013154.GA74883@winnie.fuhr.org
Whole thread Raw
In response to Re: SQL Function Performance  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
On Mon, Feb 13, 2006 at 07:57:07PM -0500, Tom Lane wrote:
> "Adnan DURSUN" <a_dursun@hotmail.com> writes:
> >>>> EXPLAIN ANALYZE EXECUTE stmt (...);
>
> >    Here is the EXPLAIN ANALYZE output for prepared statement :
>
> This is exactly the same as the other plan --- you did not parameterize
> the query.  To see what's going on, you need to insert PREPARE
> parameters in the places where the function uses plpgsql variables.

Actually it was an SQL function, but that also does PREPARE/EXECUTE,
right?

Adnan, what Tom is saying is that I requested this (simplified):

PREPARE stmt (integer) AS SELECT * FROM foo WHERE id = $1;
EXPLAIN ANALYZE EXECUTE stmt (12345);

but instead you appear to have done this:

PREPARE stmt AS SELECT * FROM foo WHERE id = 12345;
EXPLAIN ANALYZE EXECUTE stmt;

We can tell because if you had done it the first way (parameterized)
then the EXPLAIN ANALYZE output would have shown the parameters as
$1, $2, $3, etc., which it didn't.

--
Michael Fuhr

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: SQL Function Performance
Next
From: "Adnan DURSUN"
Date:
Subject: Re: SQL Function Performance