From 46a0eee3006b11a15b73426c8146ed5ab32e1d62 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 28 Aug 2005 22:47:20 +0000 Subject: Tweak nodeBitmapAnd to stop evaluating sub-plan scans if it finds it's got an empty bitmap after any step; the remaining subplans can no longer affect the result. Per a suggestion from Ilia Kantor. --- src/backend/optimizer/path/indxpath.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/backend/optimizer/path/indxpath.c') diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index bd0b09fcfe..c689d1461e 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.187 2005/07/28 20:26:20 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.188 2005/08/28 22:47:20 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -538,6 +538,11 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel, List *paths) * cases, the partial index will sort before competing non-partial * indexes and so it makes the right choice, but perhaps we need to * work harder. + * + * Note: outputting the selected sub-paths in selectivity order is a good + * thing even if we weren't using that as part of the selection method, + * because it makes the short-circuit case in MultiExecBitmapAnd() more + * likely to apply. */ /* Convert list to array so we can apply qsort */ -- cgit v1.2.1