pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Adnan DURSUN <a_dursun@hotmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: SQL Function Performance
Date: Mon, 13 Feb 2006 18:31:54 -0700
Message-ID: <20060214013154.GA74883@winnie.fuhr.org> (raw)
In-Reply-To: <7000.1139878627@sss.pgh.pa.us>
References: <BAY106-DAV21E25D8CB477D5CA14A18FA070@phx.gbl>
	<7000.1139878627@sss.pgh.pa.us>

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



view thread (16+ messages)  latest in thread

Message-ID: <20060214013154.GA74883@winnie.fuhr.org>
Permalink:  ../20060214013154.GA74883@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20060214013154.GA74883@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mike@fuhr.org, tgl@sss.pgh.pa.us, a_dursun@hotmail.com
  Subject: Re: SQL Function Performance
  In-Reply-To: <20060214013154.GA74883@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox