Re: Rename Index - Deadlock

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Rename Index - Deadlock
Дата
Msg-id 10099.1268756164@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Rename Index - Deadlock  (Thomas Kenner <thomas.kenner@gmail.com>)
Список pgsql-sql
Thomas Kenner <thomas.kenner@gmail.com> writes:
> Each day I'm recreating the index my_index of the table my_table. Therefore I 
> create a new index my_index_new, drop the old index my_index, and rename the 
> new index:
> ALTER INDEX my_index_new RENAME TO my_index;

> If an insert or select statement is run at the same time as the "ALTER INDEX 
> ... RENAME TO" statement, it will end up in a deadlock.

I doubt it's the RENAME that's the problem, more likely the DROP of the
old index.  That has to get an exclusive lock on the parent table to be
sure there is nothing trying to use the index.

Why exactly do you feel you need to do this every day?
        regards, tom lane


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

Предыдущее
От: Thomas Kenner
Дата:
Сообщение: Rename Index - Deadlock
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Rename Index - Deadlock