On Sat, Sep 6, 2014 at 3:01 PM, Peter Geoghegan <p...@heroku.com> wrote: > I attach another amendment/delta patch
Attached is another amendment to the patch set. With the recent addition of abbreviation support on 32-bit platforms, we should just hash the Datum representation as a uint32 on SIZEOF_DATUM != 8 platforms. -- Peter Geoghegan
From 180ad839d8f049d83a89b42a1d85c7c99a7929f0 Mon Sep 17 00:00:00 2001 From: Peter Geoghegan <p...@heroku.com> Date: Sat, 6 Sep 2014 21:39:16 -0700 Subject: [PATCH 9/9] On SIZEOF_DATUM != 4 platforms, call hash_uint32() directly In passing, remove some dead code within bttext_abbrev_abort(). --- src/backend/utils/adt/varlena.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index db4eae1..23944f2 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -2068,9 +2068,7 @@ bttext_abbrev_convert(Datum original, SortSupport ssup) char *pres; int len; Size bsize; - uint32 lohalf, - hihalf, - hash; + uint32 hash; /* * Abbreviated key representation is a pass-by-value Datum that is treated @@ -2143,9 +2141,18 @@ retry: memcpy(pres, tss->buf2, Min(sizeof(Datum), bsize)); /* Hash abbreviated key */ - lohalf = (uint32) res; - hihalf = (uint32) (res >> 32); - hash = hash_uint32(lohalf ^ hihalf); +#if SIZEOF_DATUM == 8 + { + uint32 lohalf, + hihalf; + + lohalf = (uint32) res; + hihalf = (uint32) (res >> 32); + hash = hash_uint32(lohalf ^ hihalf); + } +#else /* SIZEOF_DATUM != 8 */ + hash = hash_uint32((uint32) res); +#endif addHyperLogLog(&tss->abbr_card, hash); @@ -2168,8 +2175,7 @@ bttext_abbrev_abort(int memtupcount, double rowhint, SortSupport ssup) { TextSortSupport *tss = (TextSortSupport *) ssup->ssup_extra; double abbrev_distinct, - key_distinct, - norm_key_card; + key_distinct; Assert(ssup->abbrev_state == ABBREVIATED_KEYS_YES); @@ -2289,12 +2295,6 @@ bttext_abbrev_abort(int memtupcount, double rowhint, SortSupport ssup) return false; /* - * Normalized cardinality is proportion of distinct original, authoritative - * keys - */ - norm_key_card = key_distinct / (double) memtupcount; - - /* * Abort abbreviation strategy. * * The worst case, where all abbreviated keys are identical while all -- 1.9.1
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers