Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available

2025-03-27 Thread Jianghua Yang
*I agree, so this patch only affects explain analyze.* *1. This change to CLOCK_MONOTONIC_COARSE only affects EXPLAIN ANALYZE and does not impact other modules.* The patch introduces optional support for CLOCK_MONOTONIC_COARSE specifically within the INSTR_TIMEinstrumentation framework. The modif

Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available

2025-03-27 Thread Andres Freund
Hi, On 2025-03-26 23:09:42 -0400, Tom Lane wrote: > =?UTF-8?B?5p2o5rGf5Y2O?= writes: > > This patch modifies the instr_time.h header to prefer CLOCK_MONOTONIC_COARSE > > when available. > > As far as I know, our usage of instr_time really needs the highest > resolution available, because we are

Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available

2025-03-26 Thread wenhui qiu
> > HI > > > As far as I know, our usage of instr_time really needs the highest > resolution available, because we are usually trying to measure pretty > short intervals. You say that this patch reduces execution time, > and I imagine that's true ... but I wonder if it doesn't do so at > the cost

Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available

2025-03-26 Thread Tom Lane
=?UTF-8?B?5p2o5rGf5Y2O?= writes: > This patch modifies the instr_time.h header to prefer CLOCK_MONOTONIC_COARSE > when available. As far as I know, our usage of instr_time really needs the highest resolution available, because we are usually trying to measure pretty short intervals. You say that

Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available

2025-03-26 Thread Michael Paquier
On Wed, Mar 26, 2025 at 11:14:47AM -0700, 杨江华 wrote: > This patch modifies the instr_time.h header to prefer CLOCK_MONOTONIC_COARSE > when available. By using CLOCK_MONOTONIC_COARSE, we can leverage a lower > resolution(4ms) but faster alternative for timing operations, which reduces > the overhead

Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available

2025-03-26 Thread Jianghua Yang
It Makes sense, but we can distinguish such code which needs ` CLOCK_MONOTONIC`. Now I add the configure option `--with-clock-monotonic-coarse`. Michael Paquier 于2025年3月26日周三 15:34写道: > On Wed, Mar 26, 2025 at 11:14:47AM -0700, 杨江华 wrote: > > This patch modifies the instr_time.h header to pref

Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available

2025-03-26 Thread 杨江华
OUNT(*) FROM t1;, > which means the overhead of timing operations has been significantly > reduced. > > > This change provides around a *20-30%* reduction in execution time for > the tested query. > > > *Patch Details:* > > From 91d61b8c9a60f0e19b73e03c1a0e46d2dc64573d Mon Sep 17 00:00:00 2001 >

Use CLOCK_MONOTONIC_COARSE for instr_time when available

2025-03-26 Thread 杨江华
Details:* >From 91d61b8c9a60f0e19b73e03c1a0e46d2dc64573d Mon Sep 17 00:00:00 2001 From: Jianghua Yang Date: Thu, 27 Mar 2025 01:58:58 +0800 Subject: [PATCH] Use CLOCK_MONOTONIC_COARSE for instr_time when available This patch modifies `instr_time.h` to prefer `CLOCK_MONOTONIC_COARSE` when availa