From: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
---|---|
To: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
Cc: | Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Statistics and selectivity estimation for ranges |
Date: | 2013-03-13 06:44:14 |
Message-ID: | CAPpHfduTp5NOx_gbwfAxRc_OeOtN2_Yhtqo3o0S=x70ovtziww@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi!
Thanks for your work on this patch!
On Tue, Mar 12, 2013 at 8:03 PM, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com
> wrote:
> So, after some hacking, I ended up with this version. I find it more
> readable, I hope I didn't miss anything. This seems to produce results that
> are close, but not identical, to the original patch. I'm not sure where the
> discrepancy is coming from, or which patch is more correct in that respect.
> I'll continue from this tomorrow, but if you have the time, please take a
> look and let me know what you think.
>
I've read your explanation and version of patch. In general it seems
correct to me.
There is one point why I have breaked up abstraction in some functions is
infinities. For example, in calc_length_hist_frac one or both of length1
and length2 can be infinity. In the line
> frac = area / (length2 - length1);
you can get NaN result. I've especially adjusted the code to get more of
less correct result in this case.
Another minor note about this line
> bin_width *= get_position(typcache, lower, &hist_lower[i],
> &hist_lower[i + 1]);
ITSM it sould looks like
> bin_width -= 1.0 - get_position(typcache, lower, &hist_lower[i],
> &hist_lower[i + 1]);
Imagine lower and upper bounds fall into same histogram bin. In this case
we should subtract lengths of both parts which were cut in the left and in
the right.
------
With best regards,
Alexander Korotkov.
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2013-03-13 07:39:01 | Re: leaking lots of unreferenced inodes (pg_xlog files?), maybe after moving tables and indexes to tablespace on different volume |
Previous Message | Craig Ringer | 2013-03-13 06:42:18 | Re: Re: Proposal for Allow postgresql.conf values to be changed via SQL [review] |