Re: Patch for 8.5, transformationHook

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch for 8.5, transformationHook
Date: 2009-04-18 15:09:00
Message-ID: 162867790904180809r27e69f9u3bbf70deabe341fa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/4/18 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> 2009/4/11 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>> No, I was complaining that a hook right there is useless and expensive.
>>> transformExpr() is executed multiple times per query, potentially a very
>>> large number of times per query; so even testing to see if a hook exists
>>> is not a negligible cost.
>
>> I did some tests based on pgbench.
>
> The queries done by pgbench are completely trivial and do not stress
> parser performance.  Even if they did (consider cases likw an IN with a
> few thousand list items), the parser is normally not a bottleneck
> compared to transaction overhead, network round trips, and pgbench
> itself.
>
>> I though about different position of hook, but only in this place the
>> hook is useful (because expressions are recursive).
>
> As I keep saying, a hook there is useless, at least by itself.  You
> have no control over the grammar and no ability to modify what the
> rest of the system understands.

There are lot of things, that should be done with current grammar only
on transformation stage. Currently pg do it now. There are lot of
pseudo functions, that are specially transformed: least, greatest,
coalesce. After hooking we should do some similar work from outer
libraries.

 The only application I can think of is
> to fool with the transformation of FuncCall nodes, which you could do in
> a much lower-overhead way by hooking into transformFuncCall.  Even that
> seems pretty darn marginal for real-world problems.

FuncCall should be. The base what I want is possible via
transformFuncCall. Probably we cannot emulate Oracle's empty string
behave, but it wasn't important :).

regards
Pavel Stehule

>
>                        regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ian Barwick 2009-04-18 15:12:09 8.4b1: Query returning results in different order to 8.3
Previous Message Heikki Linnakangas 2009-04-18 13:29:26 Re: [PATCH] unalias of ACL_SELECT_FOR_UPDATE