Search Postgresql Archives

Re: EXPLAIN with anonymous DO block?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ron <ronljohnsonjr@xxxxxxxxx> writes:
> There's a query inside a DO block which -- because it's parameterized -- I'd 
> rather analyze while it's in the FOR loop of a DO block, instead of pulling 
> it out and hard-coding the parameters.

> Is this possible?

No.

The thing to do to duplicate the behavior of a plpgsql query is
to set it up as a PREPAREd statement (with parameters for any
plpgsql variables it references) and use EXPLAIN EXECUTE.
This also works if you're curious about the behavior of a
query issued via PQexecParams or the like.

It's recommendable to repeat the EXPLAIN half a dozen times
to see if the plancache switches from a custom to a generic
plan.  (In recent PG releases, changing plan_cache_mode
is another way to check what happens.)

			regards, tom lane






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux