diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/commands/explain.h | 4 | ||||
-rw-r--r-- | src/include/executor/instrument.h | 39 | ||||
-rw-r--r-- | src/include/nodes/parsenodes.h | 3 | ||||
-rw-r--r-- | src/include/nodes/plannodes.h | 14 |
4 files changed, 56 insertions, 4 deletions
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index 25bb0ecc490..d40bc896ac5 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * - * $Id: explain.h,v 1.11 2001/01/24 19:43:23 momjian Exp $ + * $Id: explain.h,v 1.12 2001/09/18 01:59:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -16,6 +16,6 @@ #include "nodes/parsenodes.h" #include "tcop/dest.h" -extern void ExplainQuery(Query *query, bool verbose, CommandDest dest); +extern void ExplainQuery(Query *query, bool verbose, bool analyze, CommandDest dest); #endif /* EXPLAIN_H */ diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h new file mode 100644 index 00000000000..ca6aa4208ab --- /dev/null +++ b/src/include/executor/instrument.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * instrument.h + * definitions for run-time statistics collection + * + * + * Copyright (c) 2001, PostgreSQL Global Development Group + * + * $Id: instrument.h,v 1.1 2001/09/18 01:59:06 tgl Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef INSTRUMENT_H +#define INSTRUMENT_H + +#include <sys/time.h> + + +typedef struct Instrumentation +{ + /* Info about current plan cycle: */ + bool running; /* TRUE if we've completed first tuple */ + struct timeval starttime; /* Start time of current iteration of node */ + struct timeval counter; /* Accumulates runtime for this node */ + double firsttuple; /* Time for first tuple of this cycle */ + double tuplecount; /* Tuples so far this cycle */ + /* Accumulated statistics across all completed cycles: */ + double startup; /* Total startup time (in seconds) */ + double total; /* Total total time (in seconds) */ + double ntuples; /* Total tuples produced */ + double nloops; /* # of run cycles for this node */ +} Instrumentation; + +extern Instrumentation *InstrAlloc(void); +extern void InstrStartNode(Instrumentation *instr); +extern void InstrStopNode(Instrumentation *instr, bool returnedTuple); +extern void InstrEndLoop(Instrumentation *instr); + +#endif /* INSTRUMENT_H */ diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 315ad113ee7..c5a68ef7c90 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parsenodes.h,v 1.143 2001/08/26 16:56:02 tgl Exp $ + * $Id: parsenodes.h,v 1.144 2001/09/18 01:59:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -709,6 +709,7 @@ typedef struct ExplainStmt NodeTag type; Query *query; /* the query */ bool verbose; /* print plan info */ + bool analyze; /* get statistics by executing plan */ } ExplainStmt; /* ---------------------- diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index 1ee5e93cb49..eef16784327 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: plannodes.h,v 1.49 2001/03/22 04:00:52 momjian Exp $ + * $Id: plannodes.h,v 1.50 2001/09/18 01:59:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -81,9 +81,21 @@ typedef struct Plan double plan_rows; /* number of rows plan is expected to emit */ int plan_width; /* average row width in bytes */ + /* + * execution state data. Having Plan point to this, rather than the + * other way round, is 100% bogus. + */ EState *state; /* at execution time, state's of * individual nodes point to one EState * for the whole top-level plan */ + + struct Instrumentation *instrument; /* Optional runtime stats for this + * plan node */ + + /* + * Common structural data for all Plan types. XXX chgParam is runtime + * data and should be in the EState, not here. + */ List *targetlist; List *qual; /* implicitly-ANDed qual conditions */ struct Plan *lefttree; |