Re: Get execution plan of dynamic query - Mailing list pgsql-general

From Tom Lane
Subject Re: Get execution plan of dynamic query
Date
Msg-id 27765.1105290358@sss.pgh.pa.us
Whole thread Raw
In response to Get execution plan of dynamic query  ("Алексей Ш." <savbr@rin.ru>)
List pgsql-general
"=?KOI8-R?Q?=E1=CC=C5=CB=D3=C5=CA =FB.?=" <savbr@rin.ru> writes:
> How to get results of EXPLAIN of dynamic query maked up in PL/PGSQL function?

Pretend that it's a prepared statement.

For example, if your plpgsql function has

    declare x int;
        y int;
    begin
    ...
    select f1 into x from tab1 where f2 = y;

then this will show the same plan as plpgsql will be using:

    prepare foo(int) as select f1 from tab1 where f2 = $1;

    explain analyze execute foo(42);

            regards, tom lane

pgsql-general by date:

Previous
From: Chris Mair
Date:
Subject: Re: PostgreSQL 8.0.0 Release Candidate 4
Next
From: Tom Lane
Date:
Subject: Re: [PORTS] PostgreSQL 8.0.0 Release Candidate 4