Re: [GENERAL] Concurrency-safe Replacing a Set of Rows (Without SERIALIZABLE)

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [GENERAL] Concurrency-safe Replacing a Set of Rows (Without SERIALIZABLE)
Дата
Msg-id CAKFQuwanD3ABa=JAeoo3JnbaTiBseTqS8nPNpF2c7owcYR8TMg@mail.gmail.com
обсуждение исходный текст
Ответ на [GENERAL] Concurrency-safe Replacing a Set of Rows (Without SERIALIZABLE)  (Gavin Wahl <gwahl@fusionbox.com>)
Ответы Re: [GENERAL] Concurrency-safe Replacing a Set of Rows (Without SERIALIZABLE)  (Gavin Wahl <gwahl@fusionbox.com>)
Список pgsql-general
On Wed, Apr 12, 2017 at 3:32 PM, Gavin Wahl <gwahl@fusionbox.com> wrote:
I have a table that stores user notifications:

CREATE TABLE notifications (
  user_id INT,
  type CHAR(1),
  PRIMARY KEY (user_id, type)
);
​[...]​


Is there any way to do this correctly without SERIALIZABLE transactions? It
would be nice to avoid having to retry transactions. Ideally I'd like to avoid
explicit locking as well.

​Given this limited example I'd probably choose to model notifications as an array on the user table.  Then just "UPDATE user SET notifications = array['a','b']::text WHERE user_id = 1;

David J.

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: [GENERAL] Error During PostGIS Build From Source on Linux
Следующее
От: Gavin Wahl
Дата:
Сообщение: Re: [GENERAL] Concurrency-safe Replacing a Set of Rows (Without SERIALIZABLE)