One of the features that can be incredibly helpful for
optimizing your PostgreSQL database performance,
\timing option in
to display the amount of time it took for a statement to execute in milliseconds.
By default, the
\timing option is disabled in
However, you can enable
it at any time by entering
\timing at the
\timing [on|off] toggle timing of commands (currently off)
finance=# \timing Timing is on. finance=# SELECT COUNT(*) FROM account; count ------- 10257 (1 row) Time: 36,114 ms finance=#
option can be useful for benchmarking different approaches to a
For example, you could write two different SQL statements that
accomplish the same task and measure the execution time of each to see which
one is faster.