Re: Deadlocks and transactions

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

On Tue, Mar 20, 2018 at 5:10 PM, JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
wrote:

> My application is a website.
>
> 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.
>

​Well, if you want a consistent point-in-time picture of the data in those
two tables you should probably perform the selects in a transaction too.​

Is there any issue/problem for User 2?
>

MVCC mechanics eliminate the possibility of deadlocking between update
queries and select queries (not select-for-update though). Because of it
deadlocking is only possible between two updating transactions.

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

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

​Yes, reply-to-all is preferred; top-posting replies is not. Please inline
or bottom-post (and trim quoting) as appropriate.​

David J.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message David Rowley 2018-03-21 00:49:15 Re: Deadlocks and transactions
Previous Message JORGE MALDONADO 2018-03-21 00:10:14 Re: Deadlocks and transactions