Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc? - Mailing list pgsql-hackers

From Lukas Fittl
Subject Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Date
Msg-id CAP53Pkw3Gzb+KTF5pu_o7tzbfZ7+qm2m6uDWuGtTJjZpV9yNpg@mail.gmail.com
Whole thread
In response to Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, Apr 12, 2026 at 1:24 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Lukas Fittl <lukas@fittl.com> writes:
> > I think either is fine. If we did it with a message, how about this at
> > the beginning of the output function?
>
> > if (loop_count == 0)
> > {
> >   printf(_("WARNING: No timing measurements collected. Report this as a bug to <%s>.\n"), PACKAGE_BUGREPORT);
> >   return;
> > }
>
> WFM.

Thanks for confirming!

I've checked with Andres off-list whether he wants to fix this
separately, or together with the earlier proposed patch to show TSC
debug info in pg_test_timing. Andres proposed we take care of this in
the same commit.

Attached v29 patch that contains those earlier changes, plus this
Coverity fix. I've also adjusted x86_tsc_frequency_khz slightly to
clarify the new arguments, and wordsmithed the commit message a bit
for clarity plus explain why we're making this change now.

FWIW, I don't think the TSC debug info change violates any feature
freeze guidelines, and it would have helped investigate the issue on
drongo / have it fail independently of the tablesample tests being
affected by the issue. I think any TSC frequency related bug reports
during beta period will also be greatly aided by having this.

Thanks,
Lukas

--
Lukas Fittl

Attachment

pgsql-hackers by date:

Previous
From: Mok
Date:
Subject: Re: New vacuum config to avoid anti wraparound vacuums
Next
From: Bertrand Drouvot
Date:
Subject: Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE