Re: Small improvement to get_base_rel_indexes()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Small improvement to get_base_rel_indexes()
Дата
Msg-id 22140.1439665559@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Small improvement to get_base_rel_indexes()  (David Rowley <david.rowley@2ndquadrant.com>)
Список pgsql-hackers
David Rowley <david.rowley@2ndquadrant.com> writes:
> Attached is a small patch which improves the way get_base_rel_indexes()
> works.

> The current version creates a new bitmapset on each recursion level then
> bms_joins() to the one on the next level up each time. I understand that
> this will patch will have about a 0 net performance improvement, but I
> thought I'd post anyway as:

> 1. It removes 5 lines of code.
> 2. It's a better example to leave in the code.

I don't know that it's a better example: it seems substantially uglier.
(Notably, you complicated the API contract of get_base_rel_indexes()
without documenting the fact: it's now dependent on the original caller
to have initialized *result to NULL.)

We might have to use a method like this if the function were returning
multiple sets; but since it is not, the existing approach seems more
readable and safer to me.
        regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Raising our compiler requirements for 9.6
Следующее
От: Jeff Janes
Дата:
Сообщение: Potential GIN vacuum bug