public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Vitale, Anthony, Sony Music <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Question on what Duration in the log
Date: Wed, 09 Apr 2025 11:02:04 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <AS8PR02MB100787E253E044418232962DC99B42@AS8PR02MB10078.eurprd02.prod.outlook.com>
References: <AS8PR02MB100787E253E044418232962DC99B42@AS8PR02MB10078.eurprd02.prod.outlook.com>
"Vitale, Anthony, Sony Music" <[email protected]> writes:
> 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
They're not measuring the same thing really, because EXPLAIN isn't
counting the time needed to transmit data to the client.
This is not just a matter of network overhead (though that can be
substantial) but also the time required to format the values into
text. If you are talking about large values, which I bet you are,
there is also the time needed to fetch them from out-of-line TOAST
storage, which is another thing that doesn't happen in EXPLAIN.
Since v17, EXPLAIN has grown a SERIALIZE option that causes it to
do everything except the network transmission, which might be
of interest in analyzing this further.
regards, tom lane
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Question on what Duration in the log
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox