Thread: Transactions in one table
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
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.
--
Olivier Gautherot
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
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;