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


1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.