Re: Horizontal scalability/sharding
От
Amit Langote
Тема
Re: Horizontal scalability/sharding
Дата
Msg-id
55E6CE91.5040800@lab.ntt.co.jp
Ответ на
Re: Horizontal scalability/sharding (Amit Langote)
Список
Дерево обсуждения
Re: Horizontal scalability/sharding Petr Jelinek <petr@2ndquadrant.com>
Re: Horizontal scalability/sharding Bruce Momjian <bruce@momjian.us>
Re: Horizontal scalability/sharding Robert Haas <robertmhaas@gmail.com>
Re: Horizontal scalability/sharding Andres Freund <andres@anarazel.de>
On 2015-09-02 PM 06:41, Amit Langote wrote: > > I think Albe may have a point here... > > Even inherited updates case appears to cause a deadlock if they are in > different queries. Demonstrated below: > > -- setup > CREATE TABLE t(a int); > CREATE TABLE t1() INHERITS(t); > CREATE TABLE t2() INHERITS(t); > > INSERT INTO t1 VALUES (1); > INSERT INTO t2 VALUES (2); > > -- in session 1 > BEGIN; > UPDATE t SET a = a + 1 WHERE a = 1; > > > -- in session 2 > BEGIN; > UPDATE t SET a = a + 1 WHERE a = 2; > > > -- back in session 1 > UPDATE t SET a = a + 1 WHERE a = 2; > > > -- back in session 2 > UPDATE t SET a = a + 1 WHERE a = 1; > > Which, I now realize, is not the worry Amit Kapila's expresses. The deadlock was *indeed detected* in this case, with all the locks in the same PG instance. In a sharded environment with multiple PG instances, that becomes tricky. DLM (distributed lock manager/deadlock detector) seems indeed necessary as Amit K. suspects. Thanks, Amit
В списке pgsql-hackers по дате отправления
От: Shulgin, Oleksandr
Дата: