Question on what Duration in the log

From: "Vitale, Anthony, Sony Music" <anthony(dot)vitale(at)sonymusic(dot)com>
To: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Question on what Duration in the log
Date: 2025-04-09 14:27:08
Message-ID: AS8PR02MB100787E253E044418232962DC99B42@AS8PR02MB10078.eurprd02.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello All

In my PG Version 14 log I have set to log the duration of sql (Example of one log row below).

2025-04-08 07:31:57 UTC:XXX(55994):XXX:[8949]:LOG: duration: 6555.756 ms execute S_381: {Actual Parameterized Sql executed}

This Shows the Execution of a JDBC Server Side Prepared statement (i.e S_381) which took 6.5 seconds.

When I run the Sql using explain analyze it runs shows an execution time of 73 ms

Planning Time: 0.773 ms
Execution Time: 73.578 ms

I am trying to understand the duration of 6.5 seconds and if it represents the time to execute the sql (Since the plan already exists) itself or the full time needed to execute the sql as well as for the last row to be fetched by the program.

The result set of the query does return 50,000+ rows

Is there anywhere that explains what exactly the duration in the log represents.

Thanks
Anthony Vitale

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2025-04-09 15:02:04 Re: Question on what Duration in the log
Previous Message Motog Plus 2025-04-06 16:02:17 Re: Memory Not Released After Batch Completion – Checkpointer/Background Writer Behavior , postgres 15