+3 votes
in Databases by (4.6k points)
I want to check the execution time of queries so that I can use the best query to fetch the data from my database. How to see the execution time of SQL query in PostgreSQL?

1 Answer

+1 vote
by (22k points)

After logging into PostgreSQL terminal, just run the following command on PostgreSQL terminal to turn on the timing.

mydb=> \timing
Timing is on.
If you want to turn off the timing, run the same command again.
mydb=> \timing
Timing is off.
...