From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Justin Pryzby <pryzby(at)telsasoft(dot)com>, Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: bitmaps and correlation |
Date: | 2020-11-27 17:27:19 |
Message-ID: | f6afd7af-4ee2-923f-ba16-2bd2810f3cbe@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 06/11/2020 19:57, Justin Pryzby wrote:
> On Fri, Nov 06, 2020 at 01:51:26PM +0000, Anastasia Lubennikova wrote:
>> The first patch is simply a refactoring and don't see any possible objections against it.
>> The second patch also looks fine to me. The logic is understandable and the code is neat.
+1
>> It wouldn't hurt to add a comment for this computation, though.
>> + pages_fetched = pages_fetchedMAX + indexCorrelation*indexCorrelation*(pages_fetchedMIN - pages_fetchedMAX);
>
> You're right. It's like this:
> // interpolate between c==0: pages_fetched=max and c==1: pages_fetched=min
> pages_fetched = min + (max-min)*(1-c**2)
> pages_fetched = min + max*(1-c**2) - min*(1-c**2)
> pages_fetched = max*(1-c**2) + min - min*(1-c**2)
> pages_fetched = max*(1-c**2) + min*(c**2)
> pages_fetched = max - max*c**2 + min*(c**2)
> pages_fetched = max + min*(c**2) - max*c**2
> pages_fetched = max + c**2 * (min-max)
>
> I'm not sure if there's a reason why it's written like that, but (min-max)
> looks odd, so I wrote it like:
> pages_fetched = max - c**2 * (max-min)
I agree min-max looks odd. max - c**2 * (max-min) looks a bit odd too,
though. Whatever we do here, though, I'd suggest that we keep it
consistent with cost_index().
Other than that, and a quick pgdindent run, this seems ready to me. I'll
mark it as Ready for Committer.
- Heikki
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Förster | 2020-11-27 17:50:55 | Re: configure and DocBook XML |
Previous Message | Peter Eisentraut | 2020-11-27 17:11:21 | Re: configure and DocBook XML |