Make deparsing of column defaults faster

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Make deparsing of column defaults faster
Дата
Msg-id CAMkU=1xPqHP=7YPeChq6n1v_qd4WGf+ZvtnR-b+gyzFqtJqMMQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: Make deparsing of column defaults faster  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
The user docs say about column defaults: "The value is any variable-free expression (subqueries and cross-references to other columns in the current table are not allowed)"

And also say about pg_get_expr "If the expression might contain Vars, specify the OID of the relation they refer to as the second parameter; if no Vars are expected, zero is sufficient"

Since defaults can't contain Vars, this patch converts the second parameter to zero in places where pg_get_expr is invoked on column defaults.  Doing this drops the time needed to run `pg_dump -s` on a 1600 column table with defaults on all columns by a factor of 40.  So pg_upgrade users with such tables should see a big win (cc Justin).

I also made the change to the other places in the source which I could identify with this issue.  \d is now much faster for such tables as well, but I didn't test the performance of the others.

There are surely more opportunities to speed up pg_get_expr for things other than column defaults, but I wanted to submit this for now.

I have not tested the pg_upgrade using source versions <8.4, because I can't get anything that old to "make check" correctly, so I have nothing to test on.

Cheers,

Jeff
Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: commitfest 2018-07
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Make deparsing of column defaults faster