Re: Convert query plan to sql query

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Convert query plan to sql query
Дата
Msg-id 21193.1415465017@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Convert query plan to sql query  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Convert query plan to sql query  (mariem <mariem.benfadhel@gmail.com>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Sat, Nov 8, 2014 at 1:09 AM, mariem <mariem.benfadhel@gmail.com> wrote:
>> I'm aware of ruleutils.c which I think is a good tool but I don't think it's
>> appropriate as it takes the parse tree as input.

> "Parse", "Rewrite", and "Plan" are distinct stages.  ruleutils.c takes
> the tree that results from rewriting, before planning has been done.
> So I'm not sure it's quite accurate to say that it takes the "parse
> tree" - rewrite rules will already have been applied.

More specifically: rewrite is a parsetree-to-parsetree transformation;
it does not change the representational rules at all.  It's true that
the "typical" use of ruleutils is on parser output (ie stored views)
but it will work fine on rewriter output.

If what you're wishing for is that you could also capture the effects
of planner steps that are in the nature of source-to-source
transformations, I think that's going to be harder because no great
effort has been made to keep those at arm's length from steps that
don't have results describable as pure SQL.  However, you could probably
get pretty far if you applied ruleutils.c to the modified parse tree
after the constant-folding and join tree simplification phases.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: row_to_json bug with index only scans: empty keys!
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Add CREATE support to event triggers