Transactions in one table

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Transactions in one table

JORGE MALDONADO
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
Reply | Threaded
Open this post in threaded view
|

Re: Transactions in one table

Olivier Gautherot-2
Hi Jorge,

On Fri, Sep 27, 2019 at 1:22 PM JORGE MALDONADO <[hidden email]> 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.


Reply | Threaded
Open this post in threaded view
|

Re: Transactions in one table

David G Johnston
In reply to this post by JORGE MALDONADO
On Fri, Sep 27, 2019 at 9:22 AM JORGE MALDONADO <[hidden email]> 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

lup
Reply | Threaded
Open this post in threaded view
|

Re: Transactions in one table

lup
In reply to this post by JORGE MALDONADO

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;