Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?

From: Lukas Fittl <lukas(at)fittl(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Haibo Yan <tristan(dot)yim(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, David Geier <geidav(dot)pg(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Date: 2026-04-24 06:16:07
Message-ID: CAP53Pkw3Gzb+KTF5pu_o7tzbfZ7+qm2m6uDWuGtTJjZpV9yNpg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Apr 12, 2026 at 1:24 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Lukas Fittl <lukas(at)fittl(dot)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 Content-Type Size
v29-0001-pg_test_timing-Show-additional-TSC-clock-source-.patch application/octet-stream 12.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2026-04-24 06:21:25 Re: Fix race condition in pg_get_publication_tables with concurrent DROP TABLE
Previous Message Mok 2026-04-24 06:15:48 Re: New vacuum config to avoid anti wraparound vacuums