Re: Microoptimization of Bitmapset usage in postgres_fdw

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: Microoptimization of Bitmapset usage in postgres_fdw
Дата
Msg-id C9E798C6-B288-4789-B482-CEA901FA47C2@yesql.se
обсуждение исходный текст
Ответ на Re: Microoptimization of Bitmapset usage in postgres_fdw  (Nathan Bossart <bossartn@amazon.com>)
Ответы Re: Microoptimization of Bitmapset usage in postgres_fdw  ("Bossart, Nathan" <bossartn@amazon.com>)
Список pgsql-hackers
> On 14 Jun 2018, at 16:56, Nathan Bossart <bossartn@amazon.com> wrote:

> The v2 patches look good to me.  However, I found a couple other
> places where we might be able to use this micro-optimization.

Thanks a lot for your review!

> 1) dependencies_clauselist_selectivity() in dependencies.c
>
>     /*
>      * If there's not at least two distinct attnums then reject the whole list
>      * of clauses. We must return 1.0 so the calling function's selectivity is
>      * unaffected.
>      */
>     if (bms_num_members(clauses_attnums) < 2)
>     {
>         pfree(list_attnums);
>         return 1.0;
>     }

I agree with this one, not sure why I missed that when grep’ing around while
writing the patch.  Fixed in the attached v3 patchset (which are now awkwardly
named but I didn’t change that).

> 2) BuildRelationExtStatistics() in extended_stats.c.
>
>     /* check allowed number of dimensions */
>     Assert(bms_num_members(stat->columns) >= 2 &&
>            bms_num_members(stat->columns) <= STATS_MAX_DIMENSIONS);

Since this usage is in an assertion I don’t see the value in changing it as the
current programming is more optimized for readability.

cheers ./daniel


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Few cosmetic suggestions for commit 16828d5c (Fast Alter TableAdd Column...)
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Portability concerns over pq_sendbyte?