aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-04-19 22:35:18 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-04-19 22:35:18 +0000
commit4a8c5d0375f17d8d961a280cbb640996aaa8bf0d (patch)
treed12840ac104b45911406a533274add8456300815 /src/backend/commands/explain.c
parent04ce41ca622c40c0501de1e31cf888f64f1736bf (diff)
downloadpostgresql-4a8c5d0375f17d8d961a280cbb640996aaa8bf0d.tar.gz
postgresql-4a8c5d0375f17d8d961a280cbb640996aaa8bf0d.zip
Create executor and planner-backend support for decoupled heap and index
scans, using in-memory tuple ID bitmaps as the intermediary. The planner frontend (path creation and cost estimation) is not there yet, so none of this code can be executed. I have tested it using some hacked planner code that is far too ugly to see the light of day, however. Committing now so that the bulk of the infrastructure changes go in before the tree drifts under me.
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c82
1 files changed, 81 insertions, 1 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 4b2abb9e7b4..e26406365de 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.132 2005/04/16 20:07:35 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.133 2005/04/19 22:35:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -423,6 +423,12 @@ explain_outNode(StringInfo str,
case T_Append:
pname = "Append";
break;
+ case T_BitmapAnd:
+ pname = "BitmapAnd";
+ break;
+ case T_BitmapOr:
+ pname = "BitmapOr";
+ break;
case T_NestLoop:
switch (((NestLoop *) plan)->join.jointype)
{
@@ -498,6 +504,12 @@ explain_outNode(StringInfo str,
case T_IndexScan:
pname = "Index Scan";
break;
+ case T_BitmapIndexScan:
+ pname = "Bitmap Index Scan";
+ break;
+ case T_BitmapHeapScan:
+ pname = "Bitmap Heap Scan";
+ break;
case T_TidScan:
pname = "Tid Scan";
break;
@@ -586,6 +598,7 @@ explain_outNode(StringInfo str,
}
/* FALL THRU */
case T_SeqScan:
+ case T_BitmapHeapScan:
case T_TidScan:
if (((Scan *) plan)->scanrelid > 0)
{
@@ -606,6 +619,10 @@ explain_outNode(StringInfo str,
quote_identifier(rte->eref->aliasname));
}
break;
+ case T_BitmapIndexScan:
+ appendStringInfo(str, " on %s",
+ quote_identifier(get_rel_name(((BitmapIndexScan *) plan)->indxid)));
+ break;
case T_SubqueryScan:
if (((Scan *) plan)->scanrelid > 0)
{
@@ -696,6 +713,21 @@ explain_outNode(StringInfo str,
outer_plan,
str, indent, es);
break;
+ case T_BitmapIndexScan:
+ show_scan_qual(((BitmapIndexScan *) plan)->indxqualorig, false,
+ "Index Cond",
+ ((Scan *) plan)->scanrelid,
+ outer_plan,
+ str, indent, es);
+ break;
+ case T_BitmapHeapScan:
+ /* XXX do we want to show this in production? */
+ show_scan_qual(((BitmapHeapScan *) plan)->bitmapqualorig, false,
+ "Recheck Cond",
+ ((Scan *) plan)->scanrelid,
+ outer_plan,
+ str, indent, es);
+ /* FALL THRU */
case T_SeqScan:
case T_TidScan:
case T_SubqueryScan:
@@ -857,6 +889,54 @@ explain_outNode(StringInfo str,
}
}
+ if (IsA(plan, BitmapAnd))
+ {
+ BitmapAnd *bitmapandplan = (BitmapAnd *) plan;
+ BitmapAndState *bitmapandstate = (BitmapAndState *) planstate;
+ ListCell *lst;
+ int j;
+
+ j = 0;
+ foreach(lst, bitmapandplan->bitmapplans)
+ {
+ Plan *subnode = (Plan *) lfirst(lst);
+
+ for (i = 0; i < indent; i++)
+ appendStringInfo(str, " ");
+ appendStringInfo(str, " -> ");
+
+ explain_outNode(str, subnode,
+ bitmapandstate->bitmapplans[j],
+ NULL,
+ indent + 3, es);
+ j++;
+ }
+ }
+
+ if (IsA(plan, BitmapOr))
+ {
+ BitmapOr *bitmaporplan = (BitmapOr *) plan;
+ BitmapOrState *bitmaporstate = (BitmapOrState *) planstate;
+ ListCell *lst;
+ int j;
+
+ j = 0;
+ foreach(lst, bitmaporplan->bitmapplans)
+ {
+ Plan *subnode = (Plan *) lfirst(lst);
+
+ for (i = 0; i < indent; i++)
+ appendStringInfo(str, " ");
+ appendStringInfo(str, " -> ");
+
+ explain_outNode(str, subnode,
+ bitmaporstate->bitmapplans[j],
+ NULL,
+ indent + 3, es);
+ j++;
+ }
+ }
+
if (IsA(plan, SubqueryScan))
{
SubqueryScan *subqueryscan = (SubqueryScan *) plan;