PostgreSQL provides you with a highly advanced transaction machinery that offers countless features to developers and administrators alike. In this section, it is time to look at the basic concept of transactions.
The first important thing to know is that in PostgreSQL, everything is a transaction. If you send a simple query to the server, it is already a transaction. Here is an example:
test=# \x Expanded display is on.
test=# SELECT now(), now();
now | now
-------------------------------+------------------------------
2017-08-24 16:03:27.174253+02 | 2017-08-24 16:03:27.174253+02
(1 row)
In this case, the SELECT statement will be a separate transaction. If the same command is executed again, different timestamps will be returned.
Keep in mind that the now() function will return the transaction...