Re: postgresql : could not serialize access due to read/write dependencies among transactions

From: Kevin Grittner <kgrittn(at)gmail(dot)com>
To: Neslisah Demirci <neslisah(dot)demirci(at)markafoni(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: postgresql : could not serialize access due to read/write dependencies among transactions
Date: 2017-01-18 17:10:32
Message-ID: CACjxUsNwrE-eswM+OXpaY0yHP7XWUfdgb0njfFLE01OOE7KP_Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

On Tue, Jan 17, 2017 at 10:54 PM, Neslisah Demirci
<neslisah(dot)demirci(at)markafoni(dot)com> wrote:

> could not serialize access due to read/write dependencies among
> transactions

> I also add an index to my query and my query's execution plan
> don't use seq scan .

These two issues are likely to be somewhat related -- if a
sequential scan is used, then any write to that table by another
connection causes a read-write dependency (a/k/a rw-conflict),
which can eventually contribute to a serialization failure. If you
can cause narrower access through indexes, you may see a
significant drop in the frequency of these serialization failures.
You might want to post the query and its execution plan with all
the information suggested here (exact pg version, configuration
information, machine descriptions, etc.):

https://wiki.postgresql.org/wiki/SlowQueryQuestions

On the other hand, if you are going to use serializable
transactions (or even repeatable read transactions) you should
probably be using some framework that can retry the transaction
from the start on a serialization failure.

You might be interested in this set of examples of how serializable
transactions differ from repeatable read:

https://wiki.postgresql.org/wiki/SSI

And of course, if you haven't already read the fine manual on the
topic:

https://www.postgresql.org/docs/current/static/mvcc.html

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ravi Tammineni 2017-01-18 19:04:18 Re: Queries are taking way longer in 9.6 than 9.5
Previous Message Matthieu Lejeune 2017-01-18 15:23:49 Pg_upgradecluster failed

Browse pgsql-general by date

  From Date Subject
Next Message philolilou 2017-01-18 18:34:33 Database of articles, LaTeX code and pictures
Previous Message Alvaro Herrera 2017-01-18 15:03:35 Re: Ynt:postgresql : could not serialize access due to read/write dependencies among transactions