aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1998-04-27 16:57:09 +0000
committerMarc G. Fournier <scrappy@hub.org>1998-04-27 16:57:09 +0000
commit5e202d8586b32b07217bd471036209aa73af67f5 (patch)
tree7ac31fab95e70fd6337205c6a6498667c6c13c32
parent6d817475b243c0b220176b0ee0c631d0b33f97bd (diff)
downloadpostgresql-5e202d8586b32b07217bd471036209aa73af67f5.tar.gz
postgresql-5e202d8586b32b07217bd471036209aa73af67f5.zip
show the index used in an explain
From: Zeugswetter Andreas SARZ <Andreas.Zeugswetter@telecom.at>
-rw-r--r--src/backend/commands/explain.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index a8b32e2e0a1..82ef0a2939e 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.18 1998/02/26 04:30:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.19 1998/04/27 16:57:09 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,7 @@
#include <parser/parse_node.h>
#include <optimizer/planner.h>
#include <access/xact.h>
+#include <utils/relcache.h>
typedef struct ExplainState
{
@@ -117,6 +118,8 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
static void
explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
{
+ List *l;
+ Relation relation;
char *pname;
char buf[1000];
int i;
@@ -184,8 +187,12 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
appendStringInfo(str, pname);
switch (nodeTag(plan))
{
- case T_SeqScan:
case T_IndexScan:
+ appendStringInfo(str, " using ");
+ l = ((IndexScan *) plan)->indxid;
+ relation = RelationIdCacheGetRelation((int) lfirst(l));
+ appendStringInfo(str, (RelationGetRelationName(relation))->data);
+ case T_SeqScan:
if (((Scan *) plan)->scanrelid > 0)
{
RangeTblEntry *rte = nth(((Scan *) plan)->scanrelid - 1, es->rtable);