agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Surafel Temesgen <surafel3000@gmail.com>
Cc: David Steele <david@pgmasters.net>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: andrew@tao11.riddles.org.uk, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: FETCH FIRST clause WITH TIES option
Date: Wed, 3 Apr 2019 21:02:57 +0200
Message-ID: <20190403190257.44fxttkpo4yopp3l@development> (raw)
In-Reply-To: <CALAY4q86X1rCKyNE040tx1nXgH5BGeH4nxdtVbEdUuvVxEBdRw@mail.gmail.com>
References: <CALAY4q9Zd24E8OEBxOHfqQbp6u+xePXrFsnvM5xoy1pq1APUgw@mail.gmail.com>
<c1430163-a5b0-2adb-c81c-29d1029cb8cf@2ndquadrant.com>
<CALAY4q-+CKiFkgCL5VSK-9P8i5Z9uoQQh6ZEZLkjzsUT2mySsw@mail.gmail.com>
<20190204052857.GP29064@paquier.xyz>
<CALAY4q8vDyK4_jhFkXyWnJRcuWGgkwOzJTw-j2Dw0ddyTiZM4g@mail.gmail.com>
<cd96a537-a302-48ef-b41b-2e247e156745@pgmasters.net>
<CALAY4q8X-17+AFaAKZ+YX781b+pqjdU4S=z=ZUGi3QjyHpZ6hQ@mail.gmail.com>
<20190329005648.GA1136@development>
<20190331001446.GA10804@development>
<CALAY4q86X1rCKyNE040tx1nXgH5BGeH4nxdtVbEdUuvVxEBdRw@mail.gmail.com>
Hi,
Unfortunately this got broken again, this time by aef65db676 :-(
I've tried to fix the merge conflict (essentially by moving some of the
code to adjust_limit_rows_costs(), but I'm wondering if the code added to
create_limit_path is actually correct
if (count_est != 0)
{
double count_rows;
if (count_est > 0)
count_rows = (double) count_est;
else
count_rows = clamp_row_est(subpath->rows * 0.10);
if (limitOption == WITH_TIES)
{
...
count_rows = Max(avgGroupSize, count_est + (...));
}
...
}
Firstly, this seriously needs some comment explaining why we do this. But
more importantly - shouldn't it really be
count_rows = Max(avgGroupSize, count_rows + (...));
instead of using count_est again (which might easily be -1 anyway)?
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
view thread (61+ messages) latest in thread
Message-ID: <20190403190257.44fxttkpo4yopp3l@development>
Permalink: ../20190403190257.44fxttkpo4yopp3l@development/
Also on: postgresql.org/message-id/20190403190257.44fxttkpo4yopp3l@development
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tomas.vondra@2ndquadrant.com, surafel3000@gmail.com, david@pgmasters.net, michael@paquier.xyz, robertmhaas@gmail.com
Subject: Re: FETCH FIRST clause WITH TIES option
In-Reply-To: <20190403190257.44fxttkpo4yopp3l@development>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox