1

What is the equivalent of \timing on command in psql, using the psql command-line options? I am aware that this will enable timing for all psql sessions:

echo '\\timing on' >> ~/.psqlrc

I am executing an SQL file, and I am looking for an option that looks like these options below:

psql -h server -U user db -v ON_ERROR_STOP=ON --echo-all -P 'null=NULL' -f file.sql

Related:

Timur Shtatland
  • 125
  • 2
  • 11

1 Answers1

2

You can use the -c option and the -f option together. The -c must come before if you want it processed before the file is.

psql ... -c '\timing on' -f file.sql
jjanes
  • 42,332
  • 3
  • 44
  • 54