Sample Header Ad - 728x90

Finding execution time of a psql query (without any connection latency/overhead)

2 votes
1 answer
301 views
How do I find the execution time of a query? I tried these methods:
pgbench - pgbench -n -t 1 -f ./query.sql
got:
-none
latency average = 9.787 ms '
got:
-none
  total_exec_time   
--------------------
 12.242579000000001
(1 row)
--- Using EXPLAIN ANALYZE:
-none
                                           QUERY PLAN                                           
------------------------------------------------------------------------------------------------
   (cost=0.00..0.01 rows=0 width=0) (actual time=0.182..0.182 rows=0 loops=1)
   ->  Result  (cost=0.00..0.01 rows=1 width=230) (actual time=0.034..0.034 rows=1 loops=1)
 Planning Time: 0.021 ms
 Execution Time: 0.195 ms
(4 rows)
--- Now, which of those gives me the actual execution time of the query? Or rather, how can I find out the actual execution time?
Asked by Prasanna (21 rep)
Mar 13, 2025, 06:29 AM
Last activity: Mar 13, 2025, 11:15 AM