Reputation: 3053
I want to know the time that it takes to execute a query in Postgres. I see a lot of answers that suggest to use \timing
, but I'm newbie in Postgres and I don't know how to use it.
Upvotes: 24
Views: 35205
Reputation: 247400
You can use \timing
only with the command line client psql
, since this is a psql
command.
It is a switch that turns execution time reporting on and off:
test=> \timing
Timing is on.
test=> SELECT 42;
┌──────────┐
│ ?column? │
├──────────┤
│ 42 │
└──────────┘
(1 row)
Time: 0.745 ms
test=> \timing
Timing is off.
Upvotes: 35