Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Geier <geidav(dot)pg(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Lukas Fittl <lukas(at)fittl(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(at)postgresql(dot)org
Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Date: 2023-01-21 04:50:37
Message-ID: 20230121045037.GN13860@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 20, 2023 at 04:40:32PM -0800, Andres Freund wrote:
> From 5a458d4584961dedd3f80a07d8faea66e57c5d94 Mon Sep 17 00:00:00 2001
> From: Andres Freund <andres(at)anarazel(dot)de>
> Date: Mon, 16 Jan 2023 11:19:11 -0800
> Subject: [PATCH v8 4/5] wip: report nanoseconds in pg_test_timing

> <para>
> - The i7-860 system measured runs the count query in 9.8 ms while
> - the <command>EXPLAIN ANALYZE</command> version takes 16.6 ms, each
> - processing just over 100,000 rows. That 6.8 ms difference means the timing
> - overhead per row is 68 ns, about twice what pg_test_timing estimated it
> - would be. Even that relatively small amount of overhead is making the fully
> - timed count statement take almost 70% longer. On more substantial queries,
> - the timing overhead would be less problematic.
> + The i9-9880H system measured shows an execution time of 4.116 ms for the
> + <literal>TIMING OFF</literal> query, and 6.965 ms for the
> + <literal>TIMING ON</literal>, each processing 100,000 rows.
> +
> + That 2.849 ms difference means the timing overhead per row is 28 ns. As
> + <literal>TIMING ON</literal> measures timestamps twice per row returned by
> + an executor node, the overhead is very close to what pg_test_timing
> + estimated it would be.
> +
> + more than what pg_test_timing estimated it would be. Even that relatively
> + small amount of overhead is making the fully timed count statement take
> + about 60% longer. On more substantial queries, the timing overhead would
> + be less problematic.

I guess you intend to merge these two paragraphs ?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-01-21 05:14:14 Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Previous Message Andres Freund 2023-01-21 04:29:10 Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?