aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-03-08 16:59:03 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-03-08 16:59:03 +0000
commitc8cd76de2800cb35bb870e3975c16083648779bf (patch)
tree7d51bb3d9fed0ed31ff47a3de65646e99b4cac57 /src
parentd233ec299cca08f160277f42e832a80ed79cce3d (diff)
downloadpostgresql-c8cd76de2800cb35bb870e3975c16083648779bf.tar.gz
postgresql-c8cd76de2800cb35bb870e3975c16083648779bf.zip
Tweak trace_sort code to show the merge order (number of active input
tapes) for each merge step. This will give us some idea of how effective the merge distribution algorithm is.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/sort/tuplesort.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index af0109fda65..80a027d4a7a 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -91,7 +91,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.63 2006/03/07 19:06:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.64 2006/03/08 16:59:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -296,6 +296,7 @@ struct Tuplesortstate
int *tp_runs; /* # of real runs on each tape */
int *tp_dummy; /* # of dummy runs for each tape (D[]) */
int *tp_tapenum; /* Actual tape numbers (TAPE[]) */
+ int activeTapes; /* # of active input tapes in merge pass */
/*
* These variables are used after completion of sorting to keep track of
@@ -943,9 +944,15 @@ tuplesort_performsort(Tuplesortstate *state)
#ifdef TRACE_SORT
if (trace_sort)
- elog(LOG, "performsort done%s: %s",
- (state->status == TSS_FINALMERGE) ? " (except final merge)" : "",
- pg_rusage_show(&state->ru_start));
+ {
+ if (state->status == TSS_FINALMERGE)
+ elog(LOG, "performsort done (except %d-way final merge): %s",
+ state->activeTapes,
+ pg_rusage_show(&state->ru_start));
+ else
+ elog(LOG, "performsort done: %s",
+ pg_rusage_show(&state->ru_start));
+ }
#endif
MemoryContextSwitchTo(oldcontext);
@@ -1566,7 +1573,7 @@ mergeonerun(Tuplesortstate *state)
#ifdef TRACE_SORT
if (trace_sort)
- elog(LOG, "finished merge step: %s",
+ elog(LOG, "finished %d-way merge step: %s", state->activeTapes,
pg_rusage_show(&state->ru_start));
#endif
}
@@ -1614,6 +1621,7 @@ beginmerge(Tuplesortstate *state)
activeTapes++;
}
}
+ state->activeTapes = activeTapes;
/*
* Initialize space allocation to let each active input tape have an equal