Re: tableam: abstracting relation sizing code

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: tableam: abstracting relation sizing code
Дата
Msg-id 169A2D7A-E8DA-4EF7-A9DE-EB7A482783B7@yesql.se
обсуждение исходный текст
Ответ на tableam: abstracting relation sizing code  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: tableam: abstracting relation sizing code  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
> On 6 Jun 2019, at 22:40, Robert Haas <robertmhaas@gmail.com> wrote:

> It looks to me as though any table AM that uses the relation forks
> supported by PostgreSQL in a more or less normal manner is likely to
> require an implementation of the relation_size callback that is
> identical to the one for heap, and an implementation of the
> estimate_rel_size method that is extremely similar to the one for
> heap.  The latter is especially troubling as the amount of code
> duplication is non-trivial, and it's full of special hacks.

Makes sense. Regarding one of the hacks:

+     * HACK: if the relation has never yet been vacuumed, use a minimum size
+     * estimate of 10 pages.  The idea here is to avoid assuming a
+     * newly-created table is really small, even if it currently is, because
+     * that may not be true once some data gets loaded into it.

When this is a generic function for AM’s, would it make sense to make the
minimum estimate a passed in value rather than hardcoded at 10?  I don’t have a
case in mind, but I also don’t think that assumptions made for heap necessarily
makes sense for all AM’s. Just thinking out loud.

> Here is a patch that tries to improve the situation.  I don't know
> whether there is some better approach; this seemed like the obvious
> thing to do.

A small nitpick on the patch:

+ * estimate_rel_size callback, because it has a few additional paramters.

s/paramters/parameters/

cheers ./daniel


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

Предыдущее
От: Kyotaro Horiguchi
Дата:
Сообщение: Wording variations in descriptions of gucs.
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Missing generated column in ALTER TABLE ADD COLUMN doc