Re: Deadlocks and transactions - Mailing list pgsql-novice

From David G. Johnston
Subject Re: Deadlocks and transactions
Date
Msg-id CAKFQuwbDhLKE-kp_MDHZMerXb3uPWFhduPOfmL4B5nBfLLSQVg@mail.gmail.com
Whole thread Raw
In response to Re: Deadlocks and transactions  (JORGE MALDONADO <jorgemal1960@gmail.com>)
List pgsql-novice
On Tue, Mar 20, 2018 at 5:10 PM, JORGE MALDONADO <jorgemal1960@gmail.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.


(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.

pgsql-novice by date:

Previous
From: JORGE MALDONADO
Date:
Subject: Re: Deadlocks and transactions
Next
From: David Rowley
Date:
Subject: Re: Deadlocks and transactions