Обсуждение: Transactions in one table

Поиск
Список
Период
Сортировка

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

Re: Transactions in one table

От
Olivier Gautherot
Дата:
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

От
"David G. Johnston"
Дата:
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

От
Rob Sargent
Дата:
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;