-
Tom Lane authored
maintained for each cache entry. A cache entry will not be freed until the matching ReleaseSysCache call has been executed. This eliminates worries about cache entries getting dropped while still in use. See my posting to pg-hackers of even date for more info.
Tom Lane authoredmaintained for each cache entry. A cache entry will not be freed until the matching ReleaseSysCache call has been executed. This eliminates worries about cache entries getting dropped while still in use. See my posting to pg-hackers of even date for more info.
nodeMergejoin.c 48.22 KiB
/*-------------------------------------------------------------------------
*
* nodeMergejoin.c
* routines supporting merge joins
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.39 2000/11/16 22:30:22 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/*
* INTERFACE ROUTINES
* ExecMergeJoin mergejoin outer and inner relations.
* ExecInitMergeJoin creates and initializes run time states
* ExecEndMergeJoin cleans up the node.
*
* NOTES
* Essential operation of the merge join algorithm is as follows:
*
* Join { -
* get initial outer and inner tuples INITIALIZE
* Skip Inner SKIPINNER
* mark inner position JOINMARK
* do forever { -
* while (outer == inner) { JOINTEST
* join tuples JOINTUPLES
* advance inner position NEXTINNER
* } -
* advance outer position NEXTOUTER
* if (outer == mark) { TESTOUTER
* restore inner position to mark TESTOUTER
* continue -
* } else { -
* Skip Outer SKIPOUTER
* mark inner position JOINMARK
* } -
* } -
* } -
*
* Skip Outer { SKIPOUTER_BEGIN
* if (inner == outer) Join Tuples JOINTUPLES
* while (outer < inner) SKIPOUTER_TEST
* advance outer SKIPOUTER_ADVANCE
* if (outer > inner) SKIPOUTER_TEST
* Skip Inner SKIPINNER
* } -
*
* Skip Inner { SKIPINNER_BEGIN
* if (inner == outer) Join Tuples JOINTUPLES
* while (outer > inner) SKIPINNER_TEST
* advance inner SKIPINNER_ADVANCE
* if (outer < inner) SKIPINNER_TEST
* Skip Outer SKIPOUTER
* } -
*
* The merge join operation is coded in the fashion
* of a state machine. At each state, we do something and then
* proceed to another state. This state is stored in the node's
* execution state information and is preserved across calls to
* ExecMergeJoin. -cim 10/31/89
*
*/
#include "postgres.h"
#include "access/heapam.h"
#include "access/printtup.h"