PostgreSQL provides you with highly advanced transaction machinery that offers countless features to developers and administrators alike. In this section, we will 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=# SELECT now(), now();
now | now
-------------------------------+-------------------------------
2019-07-10 14:25:08.406051+02 | 2019-07-10 14:25:08.406051+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 time. The SELECT statement will, therefore, always...