Thread: Transactions in one table

Transactions in one table

From
JORGE MALDONADO
Date:
Hi,

Does it make any sense to use transactions if only one DB operation is performed in only one table?
For example, insert only one record in a "countries" table without doing anything else in other table(s). One operation, one table, that´s it.

Best regards,
Jorge Maldonado

Re: Transactions in one table

From
Olivier Gautherot
Date:
Hi Jorge,

On Fri, Sep 27, 2019 at 1:22 PM JORGE MALDONADO <jorgemal1960@gmail.com> wrote:
Hi,

Does it make any sense to use transactions if only one DB operation is performed in only one table?
For example, insert only one record in a "countries" table without doing anything else in other table(s). One operation, one table, that´s it.
 
If it works, it will perform automatically a COMMIT. If it fails, it will perform a ROLLBACK. You don't gain much with atomic operations.


Re: Transactions in one table

From
"David G. Johnston"
Date:
On Fri, Sep 27, 2019 at 9:22 AM JORGE MALDONADO <jorgemal1960@gmail.com> wrote:
Does it make any sense to use transactions if only one DB operation is performed in only one table?
For example, insert only one record in a "countries" table without doing anything else in other table(s). One operation, one table, that´s it.

Its not necessary to explicitly issue a begin/commit but it also isn't something to actively avoid.

Dave

Re: Transactions in one table

From
Rob Sargent
Date:
On 9/27/19 10:21 AM, JORGE MALDONADO wrote:
> Hi,
>
> Does it make any sense to use transactions if only one DB operation is 
> performed in only one table?
> For example, insert only one record in a "countries" table without 
> doing anything else in other table(s). One operation, one table, 
> that´s it.
>
> Best regards,
> Jorge Maldonado


When making changes interactively I highly recommend begin; <sql>; like 
the number of affected rows; commit;