Re: Collect frequency statistics for arrays

Alexander Korotkov <aekorotkov@gmail.com>

From: Alexander Korotkov <aekorotkov@gmail.com>
To: Noah Misch <noah@leadboat.com>
Cc: Nathan Boley <npboley@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2012-01-22T21:21:20Z
Lists: pgsql-hackers

Attachments

Hi!

Updated patch is attached. I've updated comment
of mcelem_array_contained_selec with more detailed description of
probability distribution assumption. Also, I found that "rest" behavious
should be better described by Poisson distribution, relevant changes were
made.

On Tue, Jan 17, 2012 at 2:33 PM, Noah Misch <noah@leadboat.com> wrote:
>
> By "summary frequency of elements", do you mean literally P_0 + P_1 ... +
> P_N?
> If so, I can follow the above argument for "column && const" and "column <@
> const", but not for "column @> const".  For "column @> const", selectivity
> cannot exceed the smallest frequency among const elements.  A number of
> high-frequency elements will drive up the sum of the frequencies without
> changing the true selectivity much at all.
>
Referencing to summary frequency is not really correct. It would be more
correct to reference to number of element in "const". When there are many
elements in "const", "column @> const" selectivity tends to be close to 0
and  "column @> const" tends to be close to 1. Surely, it's true when
elements have some kind of middle values of frequencies (not very close to
0 and not very close to 1). I've replaced "summary frequency of elements"
by "number of elements".

------
With best regards,
Alexander Korotkov.