Re: improving GROUP BY estimation - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: improving GROUP BY estimation
Date
Msg-id CAPpHfdvOBwfGQ_F6Nk+eKF0e2Bx4Z_esg7==8KAjKqP6+5-ahA@mail.gmail.com
Whole thread Raw
In response to Re: improving GROUP BY estimation  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: improving GROUP BY estimation
List pgsql-hackers
On Thu, Mar 3, 2016 at 10:16 PM, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
So yes, each estimator works great for exactly the opposite cases. But notice that typically, the results of the new formula is much higher than the old one, sometimes by two orders of magnitude (and it shouldn't be difficult to construct examples of much higher differences).

The table also includes the 'average' estimator you propose, but it's rather obvious that the result is always much closer to the new value, simply because

   (small number) + (huge number)
   ------------------------------
                  2

is always much closer to the huge number. We're usually quite happy when the estimates are within the same order of magnitude, so whether it's K or K/2 makes pretty much no difference.

I believe that Mark means geometrical average, i.e. sqrt((small number) * (huge number)).

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company 

pgsql-hackers by date:

Previous
From: Vitaly Burovoy
Date:
Subject: Re: [PATCH] Supporting +-Infinity values by to_timestamp(float8)
Next
From: Fabien COELHO
Date:
Subject: Re: pgbench small bug fix