Skip site navigation (1) Skip section navigation (2)

Design: Escort info from WHERE clause to executor?

From: peter(dot)trautmeier(at)gmx(dot)de
To: pgsql-hackers(at)postgresql(dot)org
Subject: Design: Escort info from WHERE clause to executor?
Date: 2007-07-24 16:26:14
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
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.



pgsql-hackers by date

Next:From: Jim NasbyDate: 2007-07-24 16:50:11
Subject: Re: autovacuum default parameters
Previous:From: Tom LaneDate: 2007-07-24 16:25:56
Subject: Re: EXEC_EVALDEBUG debugging broken?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group