From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Greg Stark <gsstark(at)mit(dot)edu> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Problem analyzing performance of query |
Date: | 2004-08-18 03:39:36 |
Message-ID: | 17444.1092800376@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Greg Stark <gsstark(at)mit(dot)edu> writes:
> Is there any way to ask the server what plan it's using when it's actually
> executing the query in production, rather than trying to feed it the same
> query later in another context and hope it gets the same result?
From the planner's point of view, a plpgsql query involving plpgsql
variables is a parameterized query, which is the same as a PREPAREd
query with parameters. So for instance
create function foo(int) ...
...
select ... where keycol = $1;
...
looks the same as
PREPARE q(int) AS select ... where keycol = $1;
and you can investigate the plan for this with
EXPLAIN [ANALYZE] EXECUTE q(42);
Clear? It'd be nice to have more infrastructure for debugging plpgsql
code, but so far no one's got round to building any :-(
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2004-08-18 04:02:15 | Re: apple uses Postgres for RemoteDesktop 2 |
Previous Message | Joe Conway | 2004-08-18 03:27:58 | Re: [HACKERS] SRPM for 8.0.0 beta? |