Remove very ancient tuple-counting infrastructure (IncrRetrieved() and

friends).  This code has all been ifdef'd out for many years, and doesn't
seem to have any prospect of becoming any more useful in the future.
EXPLAIN ANALYZE is what people use in practice, and I think if we did want
process-wide counters we'd be more likely to put in dtrace events for that
than try to resurrect this code.  Get rid of it so as to have one less detail
to worry about while refactoring execMain.c.
This commit is contained in:
Tom Lane 2009-10-08 22:34:57 +00:00
parent 474f825574
commit c970292a94
8 changed files with 8 additions and 149 deletions

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.81 2009/06/11 14:48:53 momjian Exp $ * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.82 2009/10/08 22:34:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -388,8 +388,6 @@ gistindex_keytest(IndexTuple tuple,
giststate = so->giststate; giststate = so->giststate;
p = BufferGetPage(so->curbuf); p = BufferGetPage(so->curbuf);
IncrIndexProcessed();
scan->xs_recheck = false; scan->xs_recheck = false;
/* /*

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.60 2009/06/11 14:48:53 momjian Exp $ * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.61 2009/10/08 22:34:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -38,11 +38,7 @@ _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
TupleDesc tupdesc = RelationGetDescr(scan->indexRelation); TupleDesc tupdesc = RelationGetDescr(scan->indexRelation);
ScanKey key = scan->keyData; ScanKey key = scan->keyData;
int scanKeySize = scan->numberOfKeys; int scanKeySize = scan->numberOfKeys;
#endif
IncrIndexProcessed();
#ifdef NOT_USED
while (scanKeySize > 0) while (scanKeySize > 0)
{ {
Datum datum; Datum datum;

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.93 2009/01/05 17:14:28 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.94 2009/10/08 22:34:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -819,8 +819,6 @@ _bt_checkkeys(IndexScanDesc scan,
tuple = (IndexTuple) PageGetItem(page, iid); tuple = (IndexTuple) PageGetItem(page, iid);
IncrIndexProcessed();
tupdesc = RelationGetDescr(scan->indexRelation); tupdesc = RelationGetDescr(scan->indexRelation);
so = (BTScanOpaque) scan->opaque; so = (BTScanOpaque) scan->opaque;
keysz = so->numberOfKeys; keysz = so->numberOfKeys;

View File

@ -26,7 +26,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.330 2009/10/05 19:24:37 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.331 2009/10/08 22:34:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -1704,7 +1704,6 @@ ExecSelect(TupleTableSlot *slot,
EState *estate) EState *estate)
{ {
(*dest->receiveSlot) (slot, dest); (*dest->receiveSlot) (slot, dest);
IncrRetrieved();
(estate->es_processed)++; (estate->es_processed)++;
} }
@ -1800,7 +1799,6 @@ ExecInsert(TupleTableSlot *slot,
newId = heap_insert(resultRelationDesc, tuple, newId = heap_insert(resultRelationDesc, tuple,
estate->es_output_cid, 0, NULL); estate->es_output_cid, 0, NULL);
IncrAppended();
(estate->es_processed)++; (estate->es_processed)++;
estate->es_lastoid = newId; estate->es_lastoid = newId;
setLastTid(&(tuple->t_self)); setLastTid(&(tuple->t_self));
@ -1908,7 +1906,6 @@ ldelete:;
return; return;
} }
IncrDeleted();
(estate->es_processed)++; (estate->es_processed)++;
/* /*
@ -2089,7 +2086,6 @@ lreplace:;
return; return;
} }
IncrReplaced();
(estate->es_processed)++; (estate->es_processed)++;
/* /*
@ -3042,8 +3038,6 @@ intorel_receive(TupleTableSlot *slot, DestReceiver *self)
myState->bistate); myState->bistate);
/* We know this is a newly created relation, so there are no indexes */ /* We know this is a newly created relation, so there are no indexes */
IncrAppended();
} }
/* /*

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.251 2009/08/06 20:44:31 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.252 2009/10/08 22:34:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -4814,8 +4814,6 @@ ExecQual(List *qual, ExprContext *econtext, bool resultForNull)
EV_nodeDisplay(qual); EV_nodeDisplay(qual);
EV_printf("\n"); EV_printf("\n");
IncrProcessed();
/* /*
* Run in short-lived per-tuple context while computing expressions. * Run in short-lived per-tuple context while computing expressions.
*/ */

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.162 2009/09/27 20:09:57 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.163 2009/10/08 22:34:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -53,85 +53,10 @@
#include "utils/tqual.h" #include "utils/tqual.h"
/* ----------------------------------------------------------------
* global counters for number of tuples processed, retrieved,
* appended, replaced, deleted.
* ----------------------------------------------------------------
*/
int NTupleProcessed;
int NTupleRetrieved;
int NTupleReplaced;
int NTupleAppended;
int NTupleDeleted;
int NIndexTupleInserted;
int NIndexTupleProcessed;
static bool get_last_attnums(Node *node, ProjectionInfo *projInfo); static bool get_last_attnums(Node *node, ProjectionInfo *projInfo);
static void ShutdownExprContext(ExprContext *econtext, bool isCommit); static void ShutdownExprContext(ExprContext *econtext, bool isCommit);
/* ----------------------------------------------------------------
* statistic functions
* ----------------------------------------------------------------
*/
/* ----------------------------------------------------------------
* ResetTupleCount
* ----------------------------------------------------------------
*/
#ifdef NOT_USED
void
ResetTupleCount(void)
{
NTupleProcessed = 0;
NTupleRetrieved = 0;
NTupleAppended = 0;
NTupleDeleted = 0;
NTupleReplaced = 0;
NIndexTupleProcessed = 0;
}
#endif
/* ----------------------------------------------------------------
* PrintTupleCount
* ----------------------------------------------------------------
*/
#ifdef NOT_USED
void
DisplayTupleCount(FILE *statfp)
{
if (NTupleProcessed > 0)
fprintf(statfp, "!\t%d tuple%s processed, ", NTupleProcessed,
(NTupleProcessed == 1) ? "" : "s");
else
{
fprintf(statfp, "!\tno tuples processed.\n");
return;
}
if (NIndexTupleProcessed > 0)
fprintf(statfp, "%d indextuple%s processed, ", NIndexTupleProcessed,
(NIndexTupleProcessed == 1) ? "" : "s");
if (NIndexTupleInserted > 0)
fprintf(statfp, "%d indextuple%s inserted, ", NIndexTupleInserted,
(NIndexTupleInserted == 1) ? "" : "s");
if (NTupleRetrieved > 0)
fprintf(statfp, "%d tuple%s retrieved. ", NTupleRetrieved,
(NTupleRetrieved == 1) ? "" : "s");
if (NTupleAppended > 0)
fprintf(statfp, "%d tuple%s appended. ", NTupleAppended,
(NTupleAppended == 1) ? "" : "s");
if (NTupleDeleted > 0)
fprintf(statfp, "%d tuple%s deleted. ", NTupleDeleted,
(NTupleDeleted == 1) ? "" : "s");
if (NTupleReplaced > 0)
fprintf(statfp, "%d tuple%s replaced. ", NTupleReplaced,
(NTupleReplaced == 1) ? "" : "s");
fprintf(statfp, "\n");
}
#endif
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* Executor state and memory management functions * Executor state and memory management functions
* ---------------------------------------------------------------- * ----------------------------------------------------------------
@ -1166,11 +1091,6 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
*/ */
result = lappend_oid(result, RelationGetRelid(indexRelation)); result = lappend_oid(result, RelationGetRelid(indexRelation));
} }
/*
* keep track of index inserts for debugging
*/
IncrIndexInserted();
} }
return result; return result;

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.573 2009/09/01 02:54:51 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.574 2009/10/08 22:34:57 tgl Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
@ -3851,7 +3851,6 @@ ResetUsage(void)
getrusage(RUSAGE_SELF, &Save_r); getrusage(RUSAGE_SELF, &Save_r);
gettimeofday(&Save_t, NULL); gettimeofday(&Save_t, NULL);
ResetBufferUsage(); ResetBufferUsage();
/* ResetTupleCount(); */
} }
void void

View File

@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/executor/execdebug.h,v 1.34 2009/01/01 17:23:58 momjian Exp $ * $PostgreSQL: pgsql/src/include/executor/execdebug.h,v 1.35 2009/10/08 22:34:57 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -30,16 +30,6 @@
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
/* ----------------
* EXEC_TUPLECOUNT is a #define which causes the
* executor to keep track of tuple counts. This might be
* causing some problems with the decstation stuff so
* you might want to undefine this if you are doing work
* on the decs - cim 10/20/89
* ----------------
#undef EXEC_TUPLECOUNT
*/
/* ---------------- /* ----------------
* EXEC_NESTLOOPDEBUG is a flag which turns on debugging of the * EXEC_NESTLOOPDEBUG is a flag which turns on debugging of the
* nest loop node by NL_printf() and ENL_printf() in nodeNestloop.c * nest loop node by NL_printf() and ENL_printf() in nodeNestloop.c
@ -79,40 +69,6 @@
#define T_OR_F(b) ((b) ? "true" : "false") #define T_OR_F(b) ((b) ? "true" : "false")
#define NULL_OR_TUPLE(slot) (TupIsNull(slot) ? "null" : "a tuple") #define NULL_OR_TUPLE(slot) (TupIsNull(slot) ? "null" : "a tuple")
/* ----------------
* tuple count debugging defines
* ----------------
*/
#ifdef EXEC_TUPLECOUNT
extern int NTupleProcessed;
extern int NTupleRetrieved;
extern int NTupleReplaced;
extern int NTupleAppended;
extern int NTupleDeleted;
extern int NIndexTupleProcessed;
extern int NIndexTupleInserted;
#define IncrRetrieved() NTupleRetrieved++
#define IncrAppended() NTupleAppended++
#define IncrDeleted() NTupleDeleted++
#define IncrReplaced() NTupleReplaced++
#define IncrInserted() NTupleInserted++
#define IncrProcessed() NTupleProcessed++
#define IncrIndexProcessed() NIndexTupleProcessed++
#define IncrIndexInserted() NIndexTupleInserted++
#else
/* stop compiler warnings */
#define IncrRetrieved() (void)(0)
#define IncrAppended() (void)(0)
#define IncrDeleted() (void)(0)
#define IncrReplaced() (void)(0)
#define IncrInserted() (void)(0)
#define IncrProcessed() (void)(0)
#define IncrIndexProcessed() (void)(0)
#define IncrIndexInserted() (void)(0)
#endif /* EXEC_TUPLECOUNT */
/* ---------------- /* ----------------
* nest loop debugging defines * nest loop debugging defines
* ---------------- * ----------------