Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available
От | Andres Freund |
---|---|
Тема | Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available |
Дата | |
Msg-id | xmtlid722biwnhrc7e7fvoqgr45evtinmjztjmjnbet4udfvae@dru4h3regeld обсуждение исходный текст |
Ответ на | Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Use CLOCK_MONOTONIC_COARSE for instr_time when available
|
Список | pgsql-hackers |
Hi, On 2025-03-26 23:09:42 -0400, Tom Lane wrote: > =?UTF-8?B?5p2o5rGf5Y2O?= <yjhjstz@gmail.com> 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 this patch reduces execution time, > and I imagine that's true ... but I wonder if it doesn't do so at > the cost of totally destroying the reliability of the output numbers. The reason, on x86, the timestamp querying has a somewhat high overhead is that the "accurate" "read the tsc" instruction serves as a barrier for out-of-order execution. With modern highly out-of-order execution that means we'll wait for all scheduled instructions to finish before determining the current time, multiple times for each tuple. That of course slows things down substantially. There's a patch to use the version of rdtsc that does *not* have barrier semantics: https://postgr.es/m/CAP53PkzO2KpscD-tgFW_V-4WS%2BvkniH4-B00eM-e0bsBF-xUxg%40mail.gmail.com Greetings, Andres Freund
В списке pgsql-hackers по дате отправления: