| From: | Lukas Fittl <lukas(at)fittl(dot)com> |
|---|---|
| To: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, 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-04-07 00:06:36 |
| Message-ID: | CAP53Pkxnv53-piUZ4f2-k5xmxXz5Xs0BQVY0==qcZK1050Nv=w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Zsolt,
On Mon, Apr 6, 2026 at 4:36 PM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
>
> +uint64 max_ticks_no_overflow = 0;
>
> Could this be int64? It is based on PG_INT64_MAX, and it's only
> practical use is with a cast to int64.
Its intentionally uint64, per this comment above it:
* Note we utilize unsigned integers even though ticks are stored as a signed
* value to encourage compilers to generate better assembly, since we can be
* sure these values are not negative.
In my earlier Compiler Explorer tests that did actually make a
difference for the generated assembly.
>
> > This allows the direct use of the Time-Stamp Counter (TSC) value retrieved
> > from the CPU using RDTSC/RDTSC instructions,
>
> Typo in commit message for 0003: RDTSC/RDTSC
>
> + else
> + printf(_("TSC clock source is not usable. Likely unable to determine
> TSC frequency. are you running in an unsupported virtualized
> environment?.\n"));
> +}
>
> Typo: are, ?.
Agreed those are typos. Since I know Andres is actively taking a look
at things right now I'll hold off on posting a new version for this,
but thanks for noting.
>
> -/* TSC specific logic */
> +/* Hardware clock specific logic (x86 TSC / AArch64 CNTVCT) */
>
> Shouldn't this ARM patch also update the documentation?
Yes, it should, but there are other open items for the ARM patch
(mainly the detection of different CPU core types causing different
CNTVCT frequencies needs to be OS agnostic), so the ARM patch is not
targeted for 19. Its just in this patch set to illustrate how we can
expand coverage for it later.
Thanks,
Lukas
--
Lukas Fittl
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2026-04-07 00:18:05 | Re: Don't use the deprecated and insecure PQcancel in our frontend tools anymore |
| Previous Message | Mihail Nikalayeu | 2026-04-06 23:53:02 | Re: Adding REPACK [concurrently] |