May 2018
Intermediate to advanced
576 pages
30h 25m
English
You might have noticed that the first query is not ended by a semicolon, as usual. This is because we end it with \gset instead, which means “run the query, and assign each returned value to a variable having the same name of the output column”.
This command expects the query to return exactly one row, as you might expect too, and if not it does not set any variable.
The script waits one second before reading the updated number of dead and live rows. The reason for the wait is that such statistics are updated after the end of the transaction that makes the changes, which sends a signal to the statistics collector which then does the update.