From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Adnan DURSUN <a_dursun(at)hotmail(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: SQL Function Performance |
Date: | 2006-02-14 01:31:54 |
Message-ID: | 20060214013154.GA74883@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Mon, Feb 13, 2006 at 07:57:07PM -0500, Tom Lane wrote:
> "Adnan DURSUN" <a_dursun(at)hotmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Chris | 2006-02-14 02:32:32 | Re: Optimizing performance of a like '%...%' condition |
Previous Message | Tom Lane | 2006-02-14 00:57:07 | Re: SQL Function Performance |