Re: Using transactions in all CRUD operations

From: Rene Romero Benavides <rene(dot)romero(dot)b(at)gmail(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Using transactions in all CRUD operations
Date: 2019-11-07 00:53:12
Message-ID: CANaGW0-L83xkmBj14KzPz1FtmPU5h8bbO_gn2KThwmicVku9pA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

The topic you need to research is "repeatable reads", if you read something
within a transaction, depending on the database isolation level, you could
get different results, if you want repeatable reads, you may need to
consider SELECT statements within transactions.

On Wed, Nov 6, 2019 at 6:42 PM JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
wrote:

> Hello,
>
> I am developing an information system applying several design patterns
> being the Unit of Work one of them. For this pattern, my code automatically
> implements the use of transactions and this means that all of the DB CRUD
> operations will use them: INSERT, UPDATE, DELETE AND SELECT statements. It
> makes sense to me that all of these operations, except for the SELECT
> statement, make use of transactions. However, my Unit of Work design
> pattern has them implemented by default. I have read some articles about
> using transactions on SELECT statements and have seen that it is not as
> absurd as it seems to me to use transactions with only SELECT statements
> inside. My main reason to use transactions in all CRUD operations is to
> maintain my Unit of Work design pattern standard. If using transactions for
> all CRUD operations is not a good practice or not recommendable, then I
> have to choice to re-design my code
>
> I will very much appreciate your valuable feedback on this topic.
>
> Respectfully,
> Jorge Maldonado
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Libre
> de virus. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_2966362734098406000_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>

--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tchouante, Merlin 2019-11-07 17:57:16 Returned row count doesn't match lines in output file
Previous Message JORGE MALDONADO 2019-11-07 00:42:15 Using transactions in all CRUD operations