pgsql: Fix thinko in estimate_num_groups

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix thinko in estimate_num_groups
Date: 2017-03-27 16:15:24
Message-ID: E1csXIi-0000GP-Ua@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix thinko in estimate_num_groups

The code for the reworked n-distinct estimation on commit 7b504eb282 was
written differently in a previous version of the patch, prior to commit;
on rewriting it, we missed updating an initializer. This caused the
code to (mistakenly) apply a fudge factor even in the case where a
single value is applied, leading to incorrect results.

This means that the 'relvarcount' variable name is now wrong. Add a
comment to try and make the situation clearer, and remove an incorrect
comment I added.

Problem noticed, and code patch, by Tomas Vondra. Additional commentary
by Álvaro.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/1f171a1803c28d3ae24636c9ca3352ec82c39e5f

Modified Files
--------------
src/backend/utils/adt/selfuncs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2017-03-27 16:19:05 Re: [COMMITTERS] pgsql: Improve performance of find_all_inheritors()
Previous Message Teodor Sigaev 2017-03-27 16:08:15 pgsql: Improve performance of find_all_inheritors()