Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Lukas Fittl <lukas(at)fittl(dot)com>
Cc: John Naylor <johncnaylorls(at)gmail(dot)com>, Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>, Hannu Krosing <hannuk(at)google(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, David Geier <geidav(dot)pg(at)gmail(dot)com>
Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Date: 2026-03-03 17:09:08
Message-ID: xapc4voxjx5ra47ci62essqxyyxyh57q6o4griutoq6inkxdgj@yqwgycwkdr6s
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Just a quick comment, haven't actually had time to look through the email/new
patch version with any care.

On 2026-03-03 02:29:06 -0800, Lukas Fittl wrote:
> - Added support for HyperV hypervisor by reading the TSC frequency
> MSR. This allows Azure Linux VMs to work as well, and in my test gives
> a similar speed up with RDTSC like reported on AWS. Only annoyance is
> that to enable it you have to make /dev/cpu/0/msr readable ("setcap
> cap_sys_rawio=ep" on the binary that accesses it + give the user/group
> access to the device file)

I rather doubt that giving even just read access to MSRs to unprivileged
userspace processes is a good idea.

But if we read files anyway, wouldn't just using
/sys/devices/system/cpu/cpu0/cpufreq/base_frequency
work?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anthonin Bonnefoy 2026-03-03 17:11:02 Re: Shutdown indefinitely stuck due to unflushed FPI_FOR_HINT record
Previous Message Sami Imseih 2026-03-03 17:08:44 Re: Fix bug in multixact Oldest*MXactId initialization and access