number and type of locks for an alter sequence

Поиск
Список
Период
Сортировка
От Thomas Poty
Тема number and type of locks for an alter sequence
Дата
Msg-id CAN_ctng+MXgtr9j1g7U-iKsK--gCKfH0BTZtJSOO+RY9cv2xRQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: number and type of locks for an alter sequence  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Hello ,

In PG10, when I am altering a sequence, i see 2 locks in pg_locks matching my sequence:
a RowExclusiveLock
and a ShareRowExclusiveLock

My question is Why 2 locks?
Someone on irc said it was for catalog but i am no sure because pg_locks.relationid is the same for the 2 locks.

At the same time, If I am trying to call nextval with an othersession, the session wants to get a RowExclusiveLock on the sequence.

So, to me, the lock ShareRowExclusiveLock is when the sequence is beeing altered.
And the RowExclusiveLock is for concurent access between alter/drop sequence and nextval/setval/curval/lastval.

Documentation seems not talking about this... (https://www.postgresql.org/docs/10/explicit-locking.html) Maybe should I open a ticket?

Thanks

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

Предыдущее
От: Ron
Дата:
Сообщение: Re: Regarding query execution for long time
Следующее
От: Durgamahesh Manne
Дата:
Сообщение: Re: Regarding query execution for long time