Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b89126

Browse files
committed
Fix bogus EXPLAIN display of rowcount estimates for BitmapAnd and
BitmapOr nodes.
1 parentbc843d3 commit4b89126

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

‎src/backend/optimizer/plan/createplan.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.183 2005/04/22 21:58:31 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.184 2005/04/23 01:29:15 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -941,7 +941,10 @@ create_bitmap_subplan(Query *root, Path *bitmapqual)
941941
newlist=lappend(newlist,subplan);
942942
}
943943
plan= (Plan*)make_bitmap_and(newlist);
944-
copy_path_costsize(plan,bitmapqual);
944+
plan->startup_cost=apath->path.startup_cost;
945+
plan->total_cost=apath->path.total_cost;
946+
plan->plan_rows=
947+
clamp_row_est(apath->bitmapselectivity*apath->path.parent->tuples);
945948
plan->plan_width=0;/* meaningless */
946949
}
947950
elseif (IsA(bitmapqual,BitmapOrPath))
@@ -957,31 +960,32 @@ create_bitmap_subplan(Query *root, Path *bitmapqual)
957960
newlist=lappend(newlist,subplan);
958961
}
959962
plan= (Plan*)make_bitmap_or(newlist);
960-
copy_path_costsize(plan,bitmapqual);
963+
plan->startup_cost=opath->path.startup_cost;
964+
plan->total_cost=opath->path.total_cost;
965+
plan->plan_rows=
966+
clamp_row_est(opath->bitmapselectivity*opath->path.parent->tuples);
961967
plan->plan_width=0;/* meaningless */
962968
}
963969
elseif (IsA(bitmapqual,IndexPath))
964970
{
965971
IndexPath*ipath= (IndexPath*)bitmapqual;
966972
IndexScan*iscan;
967-
BitmapIndexScan*bscan;
968973

969974
/* Use the regular indexscan plan build machinery... */
970975
iscan=create_indexscan_plan(root,ipath,NIL,NIL);
971976
Assert(list_length(iscan->indxid)==1);
972977
/* then convert to a bitmap indexscan */
973-
bscan=make_bitmap_indexscan(iscan->scan.scanrelid,
974-
linitial_oid(iscan->indxid),
975-
linitial(iscan->indxqual),
976-
linitial(iscan->indxqualorig),
977-
linitial(iscan->indxstrategy),
978-
linitial(iscan->indxsubtype));
979-
bscan->scan.plan.startup_cost=0.0;
980-
bscan->scan.plan.total_cost=ipath->indextotalcost;
981-
bscan->scan.plan.plan_rows=
978+
plan= (Plan*)make_bitmap_indexscan(iscan->scan.scanrelid,
979+
linitial_oid(iscan->indxid),
980+
linitial(iscan->indxqual),
981+
linitial(iscan->indxqualorig),
982+
linitial(iscan->indxstrategy),
983+
linitial(iscan->indxsubtype));
984+
plan->startup_cost=0.0;
985+
plan->total_cost=ipath->indextotalcost;
986+
plan->plan_rows=
982987
clamp_row_est(ipath->indexselectivity*ipath->path.parent->tuples);
983-
bscan->scan.plan.plan_width=0;/* meaningless */
984-
plan= (Plan*)bscan;
988+
plan->plan_width=0;/* meaningless */
985989
}
986990
else
987991
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp