Re: Deadlocks and transactions

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: Lætitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Deadlocks and transactions
Date: 2018-03-21 00:49:15
Message-ID: CAKJS1f9UDMnr_FkEPJJ_shN2cc4ae+aCgbP0UEMAWtZd2Hye1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 21 March 2018 at 13:10, JORGE MALDONADO <jorgemal1960(at)gmail(dot)com> wrote:
> Let´s suppose the following scenario.
> * User 1 has already loaded a web page and clicks a button that triggers a
> transaction that includes 2 tables.
> * User 2 loads the same page and SELECTs data from the 2 tables currently in
> the transaction generated by User 1. User 2 does not trigger a transaction
> because he/she only gets data from the DB.
>
> Is there any issue/problem for User 2?

There's no deadlock risk between a read and a write transaction. This
is mentioned in the 2nd paragraph in
https://www.postgresql.org/docs/10/static/mvcc-intro.html

That might be interesting for you to read as it explains in a bit of
detail how concurrency is handled in PostgreSQL.

> (Is it correct to reply-to-all when posting back to a question?)

Yes. It's also our preference that you don't top post in replies. We
generally use the interleaved style described in
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Rashmi V Bharadwaj 2018-03-21 07:29:48 Logical replication for DDL operations
Previous Message David G. Johnston 2018-03-21 00:48:22 Re: Deadlocks and transactions