aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeBitmapAnd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/nodeBitmapAnd.c')
-rw-r--r--src/backend/executor/nodeBitmapAnd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/executor/nodeBitmapAnd.c b/src/backend/executor/nodeBitmapAnd.c
index 1d5d94fc3f8..939062d4d6c 100644
--- a/src/backend/executor/nodeBitmapAnd.c
+++ b/src/backend/executor/nodeBitmapAnd.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapAnd.c,v 1.2 2005/04/20 15:48:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapAnd.c,v 1.3 2005/08/28 22:47:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -143,6 +143,16 @@ MultiExecBitmapAnd(BitmapAndState *node)
tbm_intersect(result, subresult);
tbm_free(subresult);
}
+
+ /*
+ * If at any stage we have a completely empty bitmap, we can fall
+ * out without evaluating the remaining subplans, since ANDing them
+ * can no longer change the result. (Note: the fact that indxpath.c
+ * orders the subplans by selectivity should make this case more
+ * likely to occur.)
+ */
+ if (tbm_is_empty(result))
+ break;
}
if (result == NULL)