From 184e7a73a5b65b040d5c6413ec249a2b47f321e7 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 13 May 2005 21:20:16 +0000 Subject: Revise nodeMergejoin in light of example provided by Guillaume Smet. When one side of the join has a NULL, we don't want to uselessly try to match it against every remaining tuple of the other side. While at it, rewrite the comparison machinery to avoid multiple evaluations of the left and right input expressions and to use a btree comparator where available, instead of double operator calls. Also revise the state machine to eliminate redundant comparisons and hopefully make it more readable too. --- src/include/executor/execdebug.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/include/executor/execdebug.h') diff --git a/src/include/executor/execdebug.h b/src/include/executor/execdebug.h index 58a987107d..9a6969ecef 100644 --- a/src/include/executor/execdebug.h +++ b/src/include/executor/execdebug.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/execdebug.h,v 1.26 2005/03/16 21:38:09 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/execdebug.h,v 1.27 2005/05/13 21:20:16 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -258,17 +258,14 @@ extern int NIndexTupleInserted; #define MJ2_printf(s, p1, p2) printf(s, p1, p2) #define MJ_debugtup(slot) debugtup(slot, NULL) #define MJ_dump(state) ExecMergeTupleDump(state) +#define MJ_DEBUG_COMPARE(res) \ + MJ1_printf(" MJCompare() returns %d\n", (res)) #define MJ_DEBUG_QUAL(clause, res) \ MJ2_printf(" ExecQual(%s, econtext) returns %s\n", \ - CppAsString(clause), T_OR_F(res)); - -#define MJ_DEBUG_MERGE_COMPARE(qual, res) \ - MJ2_printf(" MergeCompare(mergeclauses, %s, ...) returns %s\n", \ - CppAsString(qual), T_OR_F(res)); - + CppAsString(clause), T_OR_F(res)) #define MJ_DEBUG_PROC_NODE(slot) \ MJ2_printf(" %s = ExecProcNode(...) returns %s\n", \ - CppAsString(slot), NULL_OR_TUPLE(slot)); + CppAsString(slot), NULL_OR_TUPLE(slot)) #else @@ -278,8 +275,8 @@ extern int NIndexTupleInserted; #define MJ2_printf(s, p1, p2) #define MJ_debugtup(slot) #define MJ_dump(state) +#define MJ_DEBUG_COMPARE(res) #define MJ_DEBUG_QUAL(clause, res) -#define MJ_DEBUG_MERGE_COMPARE(qual, res) #define MJ_DEBUG_PROC_NODE(slot) #endif /* EXEC_MERGEJOINDEBUG */ -- cgit v1.2.1