Re: FETCH FIRST clause WITH TIES option
| От | Tomas Vondra | 
|---|---|
| Тема | Re: FETCH FIRST clause WITH TIES option | 
| Дата | |
| Msg-id | 20190403190257.44fxttkpo4yopp3l@development обсуждение исходный текст | 
| Ответ на | Re: Re: FETCH FIRST clause WITH TIES option (Surafel Temesgen <surafel3000@gmail.com>) | 
| Ответы | Re: FETCH FIRST clause WITH TIES option | 
| Список | pgsql-hackers | 
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
		
	В списке pgsql-hackers по дате отправления: