mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
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
This commit is contained in:
@ -34,9 +34,6 @@
|
|||||||
#include "utils/pg_locale.h"
|
#include "utils/pg_locale.h"
|
||||||
#include "utils/sortsupport.h"
|
#include "utils/sortsupport.h"
|
||||||
|
|
||||||
#ifdef DEBUG_ABBREV_KEYS
|
|
||||||
#define DEBUG_elog_output DEBUG1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* GUC variable */
|
/* GUC variable */
|
||||||
int bytea_output = BYTEA_OUTPUT_HEX;
|
int bytea_output = BYTEA_OUTPUT_HEX;
|
||||||
@ -2149,11 +2146,13 @@ bttext_abbrev_abort(int memtupcount, SortSupport ssup)
|
|||||||
* time there are differences within full key strings not captured in
|
* time there are differences within full key strings not captured in
|
||||||
* abbreviations.
|
* abbreviations.
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG_ABBREV_KEYS
|
#ifdef TRACE_SORT
|
||||||
|
if (trace_sort)
|
||||||
{
|
{
|
||||||
double norm_abbrev_card = abbrev_distinct / (double) memtupcount;
|
double norm_abbrev_card = abbrev_distinct / (double) memtupcount;
|
||||||
|
|
||||||
elog(DEBUG_elog_output, "abbrev_distinct after %d: %f (key_distinct: %f, norm_abbrev_card: %f, prop_card: %f)",
|
elog(LOG, "bttext_abbrev: abbrev_distinct after %d: %f "
|
||||||
|
"(key_distinct: %f, norm_abbrev_card: %f, prop_card: %f)",
|
||||||
memtupcount, abbrev_distinct, key_distinct, norm_abbrev_card,
|
memtupcount, abbrev_distinct, key_distinct, norm_abbrev_card,
|
||||||
tss->prop_card);
|
tss->prop_card);
|
||||||
}
|
}
|
||||||
@ -2219,11 +2218,11 @@ bttext_abbrev_abort(int memtupcount, SortSupport ssup)
|
|||||||
* of moderately high to high abbreviated cardinality. There is little to
|
* of moderately high to high abbreviated cardinality. There is little to
|
||||||
* lose but much to gain, which our strategy reflects.
|
* lose but much to gain, which our strategy reflects.
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG_ABBREV_KEYS
|
#ifdef TRACE_SORT
|
||||||
elog(DEBUG_elog_output, "would have aborted abbreviation due to worst-case at %d. abbrev_distinct: %f, key_distinct: %f, prop_card: %f",
|
if (trace_sort)
|
||||||
memtupcount, abbrev_distinct, key_distinct, tss->prop_card);
|
elog(LOG, "bttext_abbrev: aborted abbreviation at %d "
|
||||||
/* Actually abort only when debugging is disabled */
|
"(abbrev_distinct: %f, key_distinct: %f, prop_card: %f)",
|
||||||
return false;
|
memtupcount, abbrev_distinct, key_distinct, tss->prop_card);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user