Re: Disabling an index temporarily

Поиск
Список
Период
Сортировка
От Corey Huinker
Тема Re: Disabling an index temporarily
Дата
Msg-id CADkLM=dFPV=Oz8P3KHA07FgBCoxNa4skPyHfqnRdw=azb-hP-g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Disabling an index temporarily  (Oleg Bartunov <obartunov@gmail.com>)
Ответы Re: Disabling an index temporarily  (Bill Moran <wmoran@potentialtech.com>)
Re: Disabling an index temporarily  (Tatsuo Ishii <ishii@postgresql.org>)
Re: Disabling an index temporarily  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sun, Dec 13, 2015 at 1:33 AM, Oleg Bartunov <obartunov@gmail.com> wrote:

On Sun, Dec 13, 2015 at 1:16 AM, Jaime Casanova <jaime.casanova@2ndquadrant.com> wrote:
indexrelid = 'indexname'::regclass;

This works, but might bloat system catalog.


+1 for the functionality.
+1 for ALTER INDEX foo SET DISABLED

I mentioned the need for this functionality to PeterG as PgConfUS back in March when he asked what I missed most about Oracle, where it came into play when doing partitions swaps and similar bulk Data Warehouse operations. He didn't seem to think it would be too hard to implement.

But the real win would be the ability to disable all indexes on a table without specifying names. Even Oracle has to do this with an anonymous pl/sql block querying dba_indexes or all_indexes, a pity for such a common pattern.

So, I'd propose we following syntax:

ALTER INDEX foo SET DISABLED
-- does the SET indisvalid = false shown earlier.

ALTER TABLE foo DISABLE [NONUNIQUE] INDEXES
-- same, but joining to pg_class and possibly filtering on indisunique

REINDEX [DISABLED [INDEXES ON]] TABLE table_name [PARALLEL [degree]]
or
REINDEX [INVALID [INDEXES ON]] TABLE table_name [PARALLEL [degree]]

In this last case, REINDEX would walk the catalog as it does now, but potentially filtering the table indexes on indisvalid = false. I'd ask that we make a parallel spec part of the command even if it is not initially honored.

This would be another feather in Postgres's cap of letting the user write clear code and hiding implementation specific complexity.




















 

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

Предыдущее
От: Haribabu Kommi
Дата:
Сообщение: Re: Parallel Aggregate
Следующее
От: Bill Moran
Дата:
Сообщение: Re: Disabling an index temporarily