Re: Allow replacement of bloated primary key indexes without foreign key rebuilds

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Allow replacement of bloated primary key indexes without foreign key rebuilds
Дата
Msg-id CAM-w4HNyq+Ljq-4Kav0Y1bf_rB--+MBkxYxMNpYOCwHGhiwNSg@mail.gmail.com
обсуждение исходный текст
Ответ на Allow replacement of bloated primary key indexes without foreign key rebuilds  (Gurjeet Singh <singh.gurjeet@gmail.com>)
Ответы Re: Re: Allow replacement of bloated primary key indexes without foreign key rebuilds  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sat, Jul 7, 2012 at 4:53 AM, Gurjeet Singh <singh.gurjeet@gmail.com> wrote:
> All we need to do is allow swapping of pg_class.relfilenode of two indexes.
> This will let the dependency entries stand as they are and allow us to drop
> the bloated primary key index structure without having to rebuild the
> foreign key constraints.

Fwiw I don't like swapping relfilenodes on indexes the user created.
REINDEX currently does this but it's a bit of a hack and only works
because reindex carefully builds the new index with exactly the same
definition as the old one.

The problem you describe is one of constraints and dependencies and
not one of indexes. It seems what you really want is a way to alter
foreign key dependencies to depend on a new index. Either an explicit
command that lets you set the new dependency or what seems even better
would be to have DROP INDEX check any dependent objects to see if
there's another index that can satisfy them and change their
dependency.

These might suffer from deadlock problems but hopefully they could be
manageable since it's not a frequent operation and there aren't any
other operations that rejigger dependencies.

-- 
greg


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

Предыдущее
От: Josh Kupershmidt
Дата:
Сообщение: Re: autocomplete - SELECT fx
Следующее
От: Tom Lane
Дата:
Сообщение: Re: expression evaluation with expected datatypes