Re: Reducing expression evaluation overhead

From: Sailesh Krishnamurthy <sailesh(at)cs(dot)berkeley(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reducing expression evaluation overhead
Date: 2004-03-16 16:20:14
Message-ID: mjq4qso69xd.fsf@cs.berkeley.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

Tom> The idea I was toying with is to generate, not "x = y" with
Tom> repeated copies of x, but "placeholder = y" where placeholder
Tom> is a dummy expression tree node. Then at runtime, the CASE
Tom> code would evaluate the test expression once and save it into
Tom> the econtext so the dummy node(s) could regurgitate that
Tom> value. We already have exactly such a mechanism in place to
Tom> handle the VALUE keyword for domain check constraints; it'd
Tom> be easy to duplicate it for CASE.

That is exactly what I was proposing. I implemented something like
this in TCQ and used a Const expression tree node. This was for
something we call "grouped filters" where we build an index on
predicates from multiple queries. So if you have a bunch of queries
(say ~1000) each with a predicate "R.a ??? xxx" where ??? is one of
<.>.<=,>=,= then we evaluate using the predicate index which queries
fail for each incoming tuple.

In a separate experiment we found that ExecEvalVar is particularly
expensive for us .. this is because we have an IntermediateHeapTuple
data structure to represent join tuples (in our framework, join orders
are not fixed) .. the IHT has a set of pointers to the constituent
tuples. This means that we have to do more work in ExecEvalVar
.. essentially one more lookup into the IHT. All this was only
possible because you guys kept around the varnoold and the attnoold !!

--
Pip-pip
Sailesh
http://www.cs.berkeley.edu/~sailesh

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Cramer 2004-03-16 17:05:46 Re: Some one deleted pg_database entry how to fix it?
Previous Message Bruce Momjian 2004-03-16 16:13:27 Re: Custom format for pg_dumpall