public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andreas Karlsson <[email protected]>
To: Hannu Krosing <[email protected]>
To: Lukas Fittl <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: David Geier <[email protected]>
Cc: Jakub Wartak <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Pavel Stehule <[email protected]>
Cc: vignesh C <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: Ibrar Ahmed <[email protected]>
Cc: Maciek Sakrejda <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Date: Fri, 13 Feb 2026 17:47:16 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAMT0RQQSLRFKGAccE+Ykm5gWbqR++HZ4kh_6Vrv3tNLA=WJFWg@mail.gmail.com>
References: <CA+TgmoZMpaXoW8X8JwvKBXUZXiNbF+tOEpPzY_ocFthPNWo0Ug@mail.gmail.com>
<CAMT0RQSvvWi22_D1q9jTgiTBC5h8PDrzAwF4GTW4_-jqFGbouQ@mail.gmail.com>
<[email protected]>
<[email protected]>
<CAP53PkyooCeR8YV0BUD_xC7oTZESHz8OdA=tP7pBRHFVQ9xtKg@mail.gmail.com>
<CAP53PkxaDpPCbXeA=OpmY4DUxBVHzgivXzpA62_tRE62xfc9nA@mail.gmail.com>
<CAKZiRmzF50+drGgm6F-K1dQnuT=Khob0Q_dfZdv0-1iq4TVa4Q@mail.gmail.com>
<vbfdgjxn4rqwbnznks4zstx7t34dcrhubbmse775ou4nmcjqzi@4rugaq7sftac>
<[email protected]>
<CAP53PkxAtD_ArzxaXPMgAKTfT5Da34o-oN9JY32UbhFS3U=-6A@mail.gmail.com>
<[email protected]>
<CAP53PkxNJ2Y6G8PEpQn1zKa6ODE6k1-oP9DNqWjkTj=dC8_KiA@mail.gmail.com>
<CAMT0RQQSLRFKGAccE+Ykm5gWbqR++HZ4kh_6Vrv3tNLA=WJFWg@mail.gmail.com>
On 2/13/26 3:42 PM, Hannu Krosing wrote:
> I haven't looked at the code here yet, but when using plain rdtsc on
> modern CPUs one sees much more overhead from just the fact that the
> code is there than from calling the rdtsc instruction, and the
> overhead can vary by orders of magnitude based on how complex the work
> is that is timed.
>
> I discovered this when I timed the (then-)new dead tid lookups in the
> Vacuum in Pg 17 and saw significantly larger overhead per lookup when
> the lookups themselves were slower, i.e. a case where the lookups were
> done in random order (inded was on created on a column filled with
> random())
>
> So while just a tight loop of N million rtdsc calls will give you the
> lower limit, it is likely not very representative of actual overhead.
Isn't the same issue still there if you call clock_gettime() but that it
is just less noticeable due to the high cost of clock_gettime()?
Andreas
view thread (13+ 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], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
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