Re: [PERFORM] blocking index creation

Поиск
Список
Период
Сортировка
От Neto pr
Тема Re: [PERFORM] blocking index creation
Дата
Msg-id CA+wPC0PC7PARUOF6GB3eQTU8x0fY1Cy4H1R0Bvm-x4fZb0gVXQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PERFORM] blocking index creation  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: [PERFORM] blocking index creation
Список pgsql-performance

2017-10-11 10:46 GMT-03:00 Laurenz Albe <laurenz.albe@cybertec.at>:
Neto pr wrote:
> When creating index on table of approximately 10GB of data, the DBMS hangs (I think),
> because even after waiting 10 hours there was no return of the command.
> It happened by creating Hash indexes and B + tree indexes.
> However, for some columns, it was successfully (L_RETURNFLAG, L_PARTKEY).

> If someone has a hint how to speed up index creation so that it completes successfully.

Look if CREATE INDEX is running or waiting for a lock (check the
"pg_locks" table, see if the backend consumes CPU time).


In this moment now, there is an index being created in the Lineitem table (+ - 10 Gb), and apparently it is locked, since it started 7 hours ago.
I've looked at the pg_locks table and look at the result, it's with "ShareLock" lock mode.
Is this blocking correct? or should it be another type?

Before creating the index, should I set the type of transaction lock? What?
-------------------------------------------------------------------------------------------
SELECT
      L.mode, c.relname, locktype,  l.GRANTED, l.transactionid, virtualtransaction
FROM   pg_locks l, pg_class   c
where  c.oid = l.relation

-------------- RESULT --------------------------------------------------------------
AccessShareLockpg_class_tblspc_relfilenode_indexrelationTRUE(null)3/71
AccessShareLockpg_class_relname_nsp_indexrelationTRUE(null)3/71
AccessShareLockpg_class_oid_indexrelationTRUE(null)3/71
AccessShareLockpg_classrelationTRUE(null)3/71
AccessShareLockpg_locksrelationTRUE(null)3/71
ShareLocklineitemrelationTRUE(null)21/3769
 
Maybe there is a long-running transaction that blocks the
ACCESS EXCLUSIVE lock required.  It could also be a prepared
transaction.

Yours,
Laurenz Albe

Best Regards
Neto

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

Предыдущее
От: Purav Chovatia
Дата:
Сообщение: Re: [PERFORM] Stored Procedure Performance
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: [PERFORM] Stored Procedure Performance