|
91 | 91 | * Portions Copyright (c) 1994, Regents of the University of California |
92 | 92 | * |
93 | 93 | * IDENTIFICATION |
94 | | - * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.63 2006/03/07 19:06:50 tgl Exp $ |
| 94 | + * $PostgreSQL: pgsql/src/backend/utils/sort/tuplesort.c,v 1.64 2006/03/08 16:59:03 tgl Exp $ |
95 | 95 | * |
96 | 96 | *------------------------------------------------------------------------- |
97 | 97 | */ |
@@ -296,6 +296,7 @@ struct Tuplesortstate |
296 | 296 | int *tp_runs; /* # of real runs on each tape */ |
297 | 297 | int *tp_dummy; /* # of dummy runs for each tape (D[]) */ |
298 | 298 | int *tp_tapenum; /* Actual tape numbers (TAPE[]) */ |
| 299 | + int activeTapes; /* # of active input tapes in merge pass */ |
299 | 300 |
|
300 | 301 | /* |
301 | 302 | * These variables are used after completion of sorting to keep track of |
@@ -943,9 +944,15 @@ tuplesort_performsort(Tuplesortstate *state) |
943 | 944 |
|
944 | 945 | #ifdef TRACE_SORT |
945 | 946 | if (trace_sort) |
946 | | - elog(LOG, "performsort done%s: %s", |
947 | | - (state->status == TSS_FINALMERGE) ? " (except final merge)" : "", |
948 | | - pg_rusage_show(&state->ru_start)); |
| 947 | + { |
| 948 | + if (state->status == TSS_FINALMERGE) |
| 949 | + elog(LOG, "performsort done (except %d-way final merge): %s", |
| 950 | + state->activeTapes, |
| 951 | + pg_rusage_show(&state->ru_start)); |
| 952 | + else |
| 953 | + elog(LOG, "performsort done: %s", |
| 954 | + pg_rusage_show(&state->ru_start)); |
| 955 | + } |
949 | 956 | #endif |
950 | 957 |
|
951 | 958 | MemoryContextSwitchTo(oldcontext); |
@@ -1566,7 +1573,7 @@ mergeonerun(Tuplesortstate *state) |
1566 | 1573 |
|
1567 | 1574 | #ifdef TRACE_SORT |
1568 | 1575 | if (trace_sort) |
1569 | | - elog(LOG, "finished merge step: %s", |
| 1576 | + elog(LOG, "finished %d-way merge step: %s", state->activeTapes, |
1570 | 1577 | pg_rusage_show(&state->ru_start)); |
1571 | 1578 | #endif |
1572 | 1579 | } |
@@ -1614,6 +1621,7 @@ beginmerge(Tuplesortstate *state) |
1614 | 1621 | activeTapes++; |
1615 | 1622 | } |
1616 | 1623 | } |
| 1624 | + state->activeTapes = activeTapes; |
1617 | 1625 |
|
1618 | 1626 | /* |
1619 | 1627 | * Initialize space allocation to let each active input tape have an equal |
|
0 commit comments