Обсуждение: execution of nested loop joins

Поиск
Список
Период
Сортировка

execution of nested loop joins

От
Esha Palta
Дата:
Hi all,

nodeNestloop.c executes nested loop joins. After getting a pair of inner 
and outer it test the inner and outer tuples to see if they satisfy the 
node's qualification using function ExecQual(joinqual, econtext, false).

ExecQual evaluates join conditions one at a time.It captures one 
condition and passes it to function ExecEvalExpr which is actually a 
macro that invokes another function evalfunc(a method of ExprState 
structure).

I am not getting implementation and use of this evalfunc function. Is 
this function used to evaluate the join condition or not. If yes, then 
how it does this.

thanx
esha



Re: execution of nested loop joins

От
Martijn van Oosterhout
Дата:
On Thu, Oct 06, 2005 at 09:14:02PM +0530, Esha Palta wrote:
> ExecQual evaluates join conditions one at a time.It captures one
> condition and passes it to function ExecEvalExpr which is actually a
> macro that invokes another function evalfunc(a method of ExprState
> structure).

It's not a "method" of the ExprState structure in the way object
oriented people might think. It's a function pointer that is set to the
function PostgreSQL wants to use to evaluate the expression. It's of
type:

typedef Datum (*ExprStateEvalFunc) (ExprState *expression,                ExprContext *econtext,                bool
*isNull,               ExprDoneCond *isDone); 

It's more like a virtual method where whoever created the structure
decides which method to use. the actual function called will probably
be one of the ones in backend/executor/execQual.c. Object-orientation
for C.

> I am not getting implementation and use of this evalfunc function. Is
> this function used to evaluate the join condition or not. If yes, then
> how it does this.

It does, using one of the defined expression evaluation functions.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.