Re: Access to postgresql query optimizer output

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Seref Arikan <serefarikan(at)kurumsalteknoloji(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Access to postgresql query optimizer output
Date: 2012-10-29 16:00:53
Message-ID: CAMkU=1wYuqyPsX4just8LFWidUbWMrKa=qE16+QuWKf33bqZ2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 29, 2012 at 1:07 AM, Seref Arikan
<serefarikan(at)kurumsalteknoloji(dot)com> wrote:
> Greetings,
> I keep seeing statements like "Postgresql optimizer rewrites this query
> as...." What I'm curious about is, is there a way to obtain SQL form of the
> re-written queries somewhere in the chain of query evaluation? It does not
> make a lot sense to generate sql again, but it would help a lot to see the
> queries in their rewritten form.

The re-writing does not occur at the level of SQL, but rather at the
level of an internal representation "parse tree".

You can see these representations using these configuration settings;

debug_print_parse = on
debug_print_rewritten = on

I'm not aware of anything that turns those back into SQL.

Cheers,

Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2012-10-29 16:08:46 Re: How to print application_name in log_line_prefix (using %a)?
Previous Message Tom Lane 2012-10-29 15:58:12 Re: How to print application_name in log_line_prefix (using %a)?