10
10
*
11
11
*
12
12
* 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 $
14
14
*
15
15
*-------------------------------------------------------------------------
16
16
*/
@@ -941,7 +941,10 @@ create_bitmap_subplan(Query *root, Path *bitmapqual)
941
941
newlist = lappend (newlist , subplan );
942
942
}
943
943
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 );
945
948
plan -> plan_width = 0 ; /* meaningless */
946
949
}
947
950
else if (IsA (bitmapqual , BitmapOrPath ))
@@ -957,31 +960,32 @@ create_bitmap_subplan(Query *root, Path *bitmapqual)
957
960
newlist = lappend (newlist , subplan );
958
961
}
959
962
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 );
961
967
plan -> plan_width = 0 ; /* meaningless */
962
968
}
963
969
else if (IsA (bitmapqual , IndexPath ))
964
970
{
965
971
IndexPath * ipath = (IndexPath * ) bitmapqual ;
966
972
IndexScan * iscan ;
967
- BitmapIndexScan * bscan ;
968
973
969
974
/* Use the regular indexscan plan build machinery... */
970
975
iscan = create_indexscan_plan (root , ipath , NIL , NIL );
971
976
Assert (list_length (iscan -> indxid ) == 1 );
972
977
/* 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 =
982
987
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 */
985
989
}
986
990
else
987
991
{
0 commit comments