Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit aea652a

Browse files
committed
Make trace_sort control abbreviation debug output for the text opclass.
This is consistent with what the new numeric suppor for abbreviated keys now does, and seems much more convenient than having a separate compiler define to control this debug output. Peter Geoghegan
1 parent b216ad7 commit aea652a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/backend/utils/adt/varlena.c

+9-10
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
#include "utils/pg_locale.h"
3535
#include "utils/sortsupport.h"
3636

37-
#ifdef DEBUG_ABBREV_KEYS
38-
#define DEBUG_elog_output DEBUG1
39-
#endif
4037

4138
/* GUC variable */
4239
int bytea_output = BYTEA_OUTPUT_HEX;
@@ -2149,11 +2146,13 @@ bttext_abbrev_abort(int memtupcount, SortSupport ssup)
21492146
* time there are differences within full key strings not captured in
21502147
* abbreviations.
21512148
*/
2152-
#ifdef DEBUG_ABBREV_KEYS
2149+
#ifdef TRACE_SORT
2150+
if (trace_sort)
21532151
{
21542152
double norm_abbrev_card = abbrev_distinct / (double) memtupcount;
21552153

2156-
elog(DEBUG_elog_output, "abbrev_distinct after %d: %f (key_distinct: %f, norm_abbrev_card: %f, prop_card: %f)",
2154+
elog(LOG, "bttext_abbrev: abbrev_distinct after %d: %f "
2155+
"(key_distinct: %f, norm_abbrev_card: %f, prop_card: %f)",
21572156
memtupcount, abbrev_distinct, key_distinct, norm_abbrev_card,
21582157
tss->prop_card);
21592158
}
@@ -2219,11 +2218,11 @@ bttext_abbrev_abort(int memtupcount, SortSupport ssup)
22192218
* of moderately high to high abbreviated cardinality. There is little to
22202219
* lose but much to gain, which our strategy reflects.
22212220
*/
2222-
#ifdef DEBUG_ABBREV_KEYS
2223-
elog(DEBUG_elog_output, "would have aborted abbreviation due to worst-case at %d. abbrev_distinct: %f, key_distinct: %f, prop_card: %f",
2224-
memtupcount, abbrev_distinct, key_distinct, tss->prop_card);
2225-
/* Actually abort only when debugging is disabled */
2226-
return false;
2221+
#ifdef TRACE_SORT
2222+
if (trace_sort)
2223+
elog(LOG, "bttext_abbrev: aborted abbreviation at %d "
2224+
"(abbrev_distinct: %f, key_distinct: %f, prop_card: %f)",
2225+
memtupcount, abbrev_distinct, key_distinct, tss->prop_card);
22272226
#endif
22282227

22292228
return true;

0 commit comments

Comments
 (0)