Re: REINDEX backend filtering

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: REINDEX backend filtering
Дата
Msg-id X9lUiVIf747koDXJ@paquier.xyz
обсуждение исходный текст
Ответ на Re: REINDEX backend filtering  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: REINDEX backend filtering  (Julien Rouhaud <rjuju123@gmail.com>)
Список pgsql-hackers
On Tue, Dec 15, 2020 at 06:34:16PM +0100, Magnus Hagander wrote:
> Is this really a common enough operation that we need it in the main grammar?
>
> Having the functionality, definitely, but what if it was "just" a
> function instead? So you'd do something like:
> SELECT 'reindex index ' || i FROM pg_blah(some, arguments, here)
> \gexec
>
> Or even a function that returns the REINDEX commands directly (taking
> a parameter to turn on/off concurrency for example).
>
> That also seems like it would be easier to make flexible, and just as
> easy to plug into reindexdb?

Having control in the grammar to choose which index to reindex for a
table is very useful when it comes to parallel reindexing, because
it is no-brainer in terms of knowing which index to distribute to one
job or another.  In short, with this grammar you can just issue a set
of REINDEX TABLE commands that we know will not conflict with each
other.  You cannot get that level of control with REINDEX INDEX as it
may be possible that more or more commands conflict if they work on an
index of the same relation because it is required to take lock also on
the parent table.  Of course, we could decide to implement a
redistribution logic in all frontend tools that need such things, like
reindexdb, but that's not something I think we should let the client
decide of.  A backend-side filtering is IMO much simpler, less code,
and more elegant.
--
Michael

Вложения

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: copy.sgml and partitioned tables
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Minor documentation error regarding streaming replication protocol