Re: Design: Escort info from WHERE clause to executor?

From: imad <immaad(at)gmail(dot)com>
To: "peter(dot)trautmeier(at)gmx(dot)de" <peter(dot)trautmeier(at)gmx(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Design: Escort info from WHERE clause to executor?
Date: 2007-07-24 19:58:52
Message-ID: 1f30b80c0707241258l78992cd1o6844e8b71b455f0d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

It looks like you need a customized version of AExpr Node.
In the backend parser, an AExpr Node is constructed against each given
WHERE expression. You can store the weight along with the expression.
Further, don't forget to upgrade the copy functions and equal
functions for AExpr if you want to take this weight value all the way
upto the executor.

--Imad
www.EnterpriseDB.com

On 7/24/07, peter(dot)trautmeier(at)gmx(dot)de <peter(dot)trautmeier(at)gmx(dot)de> wrote:
> Hi all,
>
> I want to pass additional weight info from the WHERE clause to the executor and I hope someone can help me with this.
>
> I accept clauses like the following
>
> WHERE (foo='a'){1}
> WHERE (foo='a'){1} OR (bar='b'){2}
> WHERE ((foo='a'){1} OR (bar='b'){2})){42} OR (baz='c'){3}
>
> where the {} takes an integer as a weight that is attached to the preceding (partial) condition.
>
> In the executor, I need to access (1) the logical value of and (2) the weight associated with _each_ subexpression that was entered. (Getting the weight from the parser to the executor is in itself a journey it seems, as some expression types are created anew - and not copied - and lose their annotated weight over and over again.)
>
> Furthermore I need the structure of OR to be preserved; the OR-of-OR structure from the last WHERE must be preserved or at least be reconstructible and must not be folded into a 3-valued OR (as canonicalize_qual and friends do.)
>
> To sum up, I am looking for a (decently efficient) scheme that is able to
>
> (1) pass arbitrary conditional expressions from WHERE to the executor in a structure preserving way.
> (2) annotate arbitrary expressions with weights that survive on its way from the parser to the executor.
> (3) access the logical value of particular subexpressions.
>
> I have some basic ideas how at least some of the requirements might be achieved. But as I am not totally satisfied with my ideas I hope you can provide me with some fresh input.
>
> ANY ideas are welcome.
>
> Regards,
> Peter
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Kreen 2007-07-24 20:04:17 Re: pgcrypto & strong ciphers limitation
Previous Message Tom Lane 2007-07-24 19:49:33 Re: strange buildfarm failure on lionfish