Skip site navigation (1) Skip section navigation (2)

Feature: output index name in explain ...

From: Zeugswetter Andreas SARZ <Andreas(dot)Zeugswetter(at)telecom(dot)at>
To: "'pgsql-hackers(at)hub(dot)org'" <pgsql-hackers(at)hub(dot)org>
Subject: Feature: output index name in explain ...
Date: 1998-03-04 10:02:02
Message-ID: 219F68D65015D011A8E000006F8590C6010A51FC@sdexcsrv1.sd.spardat.at (view raw or flat)
Thread:
Lists: pgsql-hackers
Since I wanted to know it, I extended explain to output the used (only the
first)
index on IndexScan.
An explain with this patch applied says:

template1=> explain select * from pg_class where oid=1;
NOTICE:  QUERY PLAN:
Index Scan using pg_class_oid_index on pg_class  (cost=2.03 size=1 width=74)
EXPLAIN

Does somebody want to add it to CVS please ?
Andreas

--- src/backend/commands/explain.c	Tue Mar  3 21:10:34 1998

+++
src/backend/commands/explain.c.orig	Thu Feb 26 05:30:58 1998

@@ -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 @@

 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 @@


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);



Responses

pgsql-hackers by date

Next:From: Jan WieckDate: 1998-03-04 10:45:05
Subject: Re: [HACKERS] Lost a function overloading capability in v6.3
Previous:From: Zeugswetter Andreas SARZDate: 1998-03-04 08:34:15
Subject: Re: [HACKERS] no operator '=' for types char16 and text

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group