On 29/07/21, Matthias Apitz (guru@unixarea.de) wrote:
> El día miércoles, julio 28, 2021 a las 07:30:24p. m. +0200, Matthias Apitz escribió:
> Resulted, that the size can be 20.12cm X 7.5cm. Attached is an updated
> version as PDF. Hints/bugs are welcome.
I personally find that, after \l (list databases), connecting to a different
one with \c is pretty useful.
\? : to list help subjects
\? options
\? variables
\h
\watch [SEC] : is helpful, for example for keeping an eye on connections via pg_stat_activity
\e | \ef | \ev : is incredibly helpful if you are working on a query, function or view which you immediately want to
loadinto the database via the query buffer (setting the EDITOR env will help). Best done in production, of course.
\set ON_ERROR_STOP on : to abort on first error
\timing on : very helpful to see how fast or slowly your function or query runs
Perhaps some example pg_stat_activity calls might be worth list, eg:
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
# https://gist.github.com/rgreenjr/3637525
Rory