agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
Transactions in one table
4+ messages / 4 participants
[nested] [flat]

* Transactions in one table
@ 2019-09-27 16:21  JORGE MALDONADO <jorgemal1960@gmail.com>
  0 siblings, 3 replies; 4+ messages in thread

From: JORGE MALDONADO @ 2019-09-27 16:21 UTC (permalink / raw)
  To: pgsql-sql

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

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Transactions in one table
@ 2019-09-27 16:26  Olivier Gautherot <ogautherot@gautherot.net>
  parent: JORGE MALDONADO <jorgemal1960@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Olivier Gautherot @ 2019-09-27 16:26 UTC (permalink / raw)
  To: JORGE MALDONADO <jorgemal1960@gmail.com>; +Cc: pgsql-sql

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
https://www.linkedin.com/in/ogautherot/

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Transactions in one table
@ 2019-09-27 16:27  David G. Johnston <david.g.johnston@gmail.com>
  parent: JORGE MALDONADO <jorgemal1960@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: David G. Johnston @ 2019-09-27 16:27 UTC (permalink / raw)
  To: JORGE MALDONADO <jorgemal1960@gmail.com>; +Cc: pgsql-sql

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

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Transactions in one table
@ 2019-09-27 16:41  Rob Sargent <robjsargent@gmail.com>
  parent: JORGE MALDONADO <jorgemal1960@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Rob Sargent @ 2019-09-27 16:41 UTC (permalink / raw)
  To: pgsql-sql@lists.postgresql.org


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;






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-09-27 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27 16:21 Transactions in one table JORGE MALDONADO <jorgemal1960@gmail.com>
2019-09-27 16:26 ` Olivier Gautherot <ogautherot@gautherot.net>
2019-09-27 16:27 ` David G. Johnston <david.g.johnston@gmail.com>
2019-09-27 16:41 ` Rob Sargent <robjsargent@gmail.com>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox