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 杨江华
This reflects the correct insertion of 100 million rows instead of 10 million. -- Create table and insert 100 million rows CREATE TABLE t1(a int); INSERT INTO t1 SELECT * FROM generate_series(1, 1); -- close parallel SET max_parallel_workers_per_gather = 0; SET max_parallel_workers =