Re: PATCH: Extending the HyperLogLog API a bit

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Extending the HyperLogLog API a bit
Date: 2016-01-09 19:46:23
Message-ID: 5691638F.1030806@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/01/2016 12:08 AM, Peter Geoghegan wrote:
> On Thu, Dec 31, 2015 at 12:48 PM, Tomas Vondra
> <tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
>> 1) initHyperLogLogError(hyperLogLogState *cState, double error)
>>
>> Instead of specifying bwidth (essentially the number of bits used
>> for addressing in the counter), this allows specifying the expected
>> error rate for the counter, which is
>>
>> error_rate = 1.04 / sqrt(2^bwidth)
>>
>> So for 5% we get bwidth=5, and so on. This makes the API a bit easier
>> the use, because there are pretty much no comments about the meaning
>> of bwidth, and the existing callers simply use 10 without details.
>
> Fair, but you didn't add any better comments!
>
>> 2) freeHyperLogLog(hyperLogLogState *cState)
>>
>> I think it's a good idea to provide function "undoing" what init
>> does, i.e. freeing the internal memory etc. Currently that's trivial
>> to do, but perhaps we'll make the structure more complicated in the
>> future (albeit that might be unlikely).
>
> Seems reasonable.

Attached is v2 of the patch, adding the comments.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-extend-HyperLogLog-API-v2.patch text/x-diff 2.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stas Kelvich 2016-01-09 20:28:32 Re: Speedup twophase transactions
Previous Message Tomas Vondra 2016-01-09 19:02:35 Re: WIP: bloom filter in Hash Joins with batches