Re: Abbreviated keys for Numeric

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Abbreviated keys for Numeric
Дата
Msg-id CAM3SWZT-xHa2Er1-dEC9NzU+D==kNj8+sYYbyoSdVckiq0VNdw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Abbreviated keys for Numeric  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Ответы Re: Abbreviated keys for Numeric  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-hackers
On Sun, Mar 22, 2015 at 1:01 PM, Andrew Gierth
<andrew@tao11.riddles.org.uk> wrote:
> So here's a version 3 patch:

By the way, there was another bug in this that I forgot to point out,
but removed, here:

+ if (nss->estimating)
+ {
+ uint32 tmp = (uint32)result;
+ addHyperLogLog(&nss->abbr_card, hash_uint32(tmp));
+ }

And here:

+ if (nss->estimating)
+ {
+ uint32 tmp = ((uint32)result) ^ (uint32)((uint64) result >> 32);
+ addHyperLogLog(&nss->abbr_card, hash_uint32(tmp));
+ }

(I simply operate on the raw Datum when hashing for hyperLogLog, in a
similar manner to the text opclass, which is safe with 8 byte datums +
pass by value int64).

The problem here is that you're not calling hash_uint32() through
DatumGetUInt32() - hash_uint32() returns Datum. And yes, that matters
- see commit 2c22afaa.

You also need to indent this code correctly.

-- 
Peter Geoghegan



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Table-level log_autovacuum_min_duration
Следующее
От: Ashutosh Bapat
Дата:
Сообщение: Re: Display of multi-target-table Modify plan nodes in EXPLAIN