mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
show the index used in an explain
From: Zeugswetter Andreas SARZ <Andreas.Zeugswetter@telecom.at>
This commit is contained in:
parent
6d817475b2
commit
5e202d8586
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 <parser/parse_node.h>
|
||||||
#include <optimizer/planner.h>
|
#include <optimizer/planner.h>
|
||||||
#include <access/xact.h>
|
#include <access/xact.h>
|
||||||
|
#include <utils/relcache.h>
|
||||||
|
|
||||||
typedef struct ExplainState
|
typedef struct ExplainState
|
||||||
{
|
{
|
||||||
@ -117,6 +118,8 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
|
|||||||
static void
|
static void
|
||||||
explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
|
explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
|
||||||
{
|
{
|
||||||
|
List *l;
|
||||||
|
Relation relation;
|
||||||
char *pname;
|
char *pname;
|
||||||
char buf[1000];
|
char buf[1000];
|
||||||
int i;
|
int i;
|
||||||
@ -184,8 +187,12 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
|
|||||||
appendStringInfo(str, pname);
|
appendStringInfo(str, pname);
|
||||||
switch (nodeTag(plan))
|
switch (nodeTag(plan))
|
||||||
{
|
{
|
||||||
case T_SeqScan:
|
|
||||||
case T_IndexScan:
|
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)
|
if (((Scan *) plan)->scanrelid > 0)
|
||||||
{
|
{
|
||||||
RangeTblEntry *rte = nth(((Scan *) plan)->scanrelid - 1, es->rtable);
|
RangeTblEntry *rte = nth(((Scan *) plan)->scanrelid - 1, es->rtable);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user