Re: Creating an index on a live database

Поиск
Список
Период
Сортировка
От Alan Hodgson
Тема Re: Creating an index on a live database
Дата
Msg-id 200702060954.08303@hal.medialogik.com
обсуждение исходный текст
Ответ на Creating an index on a live database  (John McCawley <nospam@hardgeus.com>)
Список pgsql-general
On Tuesday 06 February 2007 09:38, John McCawley <nospam@hardgeus.com>
wrote:
> I have a table with a few million rows which has inserts performed on it
> roughly 50 or so times a minute.  It contains a heavily-queried column
> that I would like to add an index to, but I am concerned about a
> deadlock occurring.  Should I wait until downtime to add the index, or
> is the Postgres add index command "nice" enough to avoid deadlocks?

It won't deadlock, but it will lock out writes for the duration of the index
creation (the transactions it locks out will just pause until the lock is
released).

If you're running 8.2, though, I believe you can CREATE INDEX CONCURRENTLY,
which will create the index without requiring the write lock on the table.

--
Opportunity is missed by most people because it is dressed in overalls and
looks like work. - Thomas Edison


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

Предыдущее
От: "Thomas F. O'Connell"
Дата:
Сообщение: Re: PostgreSQL on Solaris: Changing Compilers During Point Upgrade
Следующее
От: Ron Johnson
Дата:
Сообщение: Re: PostgreSQL/FireBird