Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: David Geier <geidav.pg@gmail.com>
Cc: Lukas Fittl <lukas@fittl.com>, Andres Freund <andres@anarazel.de>, Pavel Stehule <pavel.stehule@gmail.com>, vignesh C <vignesh21@gmail.com>, Michael Paquier <michael@paquier.xyz>, Ibrar Ahmed <ibrar.ahmad@gmail.com>, Maciek Sakrejda <m.sakrejda@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-12-03T14:15:00Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
pg_test_timing: Also test RDTSC[P] timing, report time source, TSC frequency
- 16fca4825483 19 (unreleased) landed
-
Allow retrieving x86 TSC frequency/flags from CPUID
- bcb2cf41f964 19 (unreleased) landed
-
instrumentation: Standardize ticks to nanosecond conversion method
- 0022622c93d9 19 (unreleased) landed
-
instrumentation: Use Time-Stamp Counter on x86-64 to lower overhead
- 294520c44487 19 (unreleased) landed
-
Zero initialize uses of instr_time about to trigger compiler warnings
- 25b2aba0c3a5 16.0 landed
-
instr_time: Represent time as an int64 on all platforms
- 03023a2664f8 16.0 landed
-
Add 250c8ee07ed to git-blame-ignore-revs
- ff23b592ad66 16.0 cited
On Wed, Dec 3, 2025 at 6:03 AM David Geier <geidav.pg@gmail.com> wrote: > I'm wondering how to best do a GUC for something that is potentially > unavailable on the system. In that case the GUC would be superfluous. > Maybe a boolean "enable_try_fast_clocksource" GUC or a "clocksource" > enum GUC which can be "default" and "try_rdtsc", where we only include > the "try_rdtsc" enum value on x86 systems? huge_pages=on/off/try is one possible precedent. Perhaps for this case, we might do something like clock_source=auto/this/that/the_other_thing might be better. If you set it to any value other than "auto", the named source must be available, or startup fails. If you set it to auto, it picks what it believes to be the best option available, and there is some other read-only GUC (akin to huge_page_status) that tells you what it picked. I'm open to other suggestions as to how this should work, but (1) all of the existing enable_* GUCs are planner GUCs, and (2) I suspect it's short-sighted to plan for only "fast" and "not fast". -- Robert Haas EDB: http://www.enterprisedb.com