On Mon, Feb 13, 2006 at 07:57:07PM -0500, Tom Lane wrote: > "Adnan DURSUN" <a_dursun@xxxxxxxxxxx> 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