Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I would like to benchmark some SQL-queries agains my PostgreSQL database. Is there any way I can time SQL-queries using psql?

share|improve this question
2  
For more details on benchmarking PostgreSQL queries: dba.stackexchange.com/q/42012/9622 –  Franck Dernoncourt May 15 '13 at 22:29

2 Answers 2

up vote 49 down vote accepted

Just turn on timing by entering: \timing

share|improve this answer

Timing can be turned on with \timing at the psql prompt (as Caleb already said).

If you are on 8.4 or above, you can add an optional on/off argument to \timing, which can be helpful if you want to be able to set timing on in .psqlrc - you can then set \timing on explicitly in a script where plain \timing would otherwise toggle it off

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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