Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQkdw-00Gt0a-3C for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Dec 2025 11:03:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQkdv-00CuMu-2f for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Dec 2025 11:03:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQkdv-00CuMm-1g for pgsql-hackers@lists.postgresql.org; Wed, 03 Dec 2025 11:03:31 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQkdt-002u9t-2f for pgsql-hackers@postgresql.org; Wed, 03 Dec 2025 11:03:31 +0000 Received: by mail-wm1-x341.google.com with SMTP id 5b1f17b1804b1-47775fb6cb4so47749025e9.0 for ; Wed, 03 Dec 2025 03:03:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764759808; x=1765364608; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=y4aP96gxBO7UjSu+TzSSHQzFPIB11mmCLrJcTgVwpBw=; b=dMsIU1fn94jASOuzKubK/She8EGioE3BopRhfOqvfH7BbwLbEH5zxxEucnYq9p6rzo mvVcINaWbPVno521U/DMNXeYZs6b3jQEq0uFVFWCDZk9729BmgVF9sx8ydJfW5Gjtyje tcFOoaey8AX7qEDVL90LHG758qjZQ+vahmUPG7jvwF2RhSYe9WuppoeyvTIUzfW1cwU1 E3bsNARmrkhRR5rU+9tPRMcw5UJaKv0sovHqCKrfYma/Z+0u1TqiU84HfoGc7RCEYM1w ELvJfSqlmJgpxOBxnBXpNkk33tTor+KyyayohBxIfiFotccoY4j+B6Omc66DjZXWP033 Cn4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764759808; x=1765364608; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=y4aP96gxBO7UjSu+TzSSHQzFPIB11mmCLrJcTgVwpBw=; b=lYnM3K2ZputUqWCJcUNC7AlNF+VDW+tMfDgP1pErrL5t0q0+qhS3C1GJwM2jZOHmWk g2g5LMN9cRz9FuwH1idxv39xc4TPDQHom5EV0np4irNuD0a8RJRODddmWpbBufHznSIJ 5vrJkhpsef5g29dDkzyzHPo14AgTwWpGEU6DmvWL4Nb3/3DNYxtG16blxCagW9XOgG1R HL5TRQDIBRueYQancTiRci1O7XZG1/UnFBroKjJjISThFElbYios0ilSOMDhlXrgXXEX Gq/jqWBfQNgJaorexU0sA1SVemWJn5Gf2e0Fs3Qi5LYszrW0Ps5GnWWLMarylGKjk7Jn Ffgw== X-Forwarded-Encrypted: i=1; AJvYcCXKZ9rw7Ocwzup1/mPjOfXcWLB/bhRWmdZguIBgiPDtsPirVj1qxbnpgVX51p96xf5wfKAa3Qytglrgvpev@postgresql.org X-Gm-Message-State: AOJu0YwhSVCVAt3s2Xkpe78X7FglBvjdzVL6xdSxGpKM+Oppoq/PLOuD fvxxEwMqsz0waonTbnrkArgy9mMI7IK9CYMsECGGumHGJ8qjDzQg3l5a X-Gm-Gg: ASbGncue+w8MqZ9LQKNAjJq2fuvtQNAUpokGPgF0rpw/kCc5iiBVaYBHdXAmAVzGTTW PRxkrYzDtvnmwrhHHozLqcK/t7I7aiXMfllr6YDIlfrl24ZeL7BeeLZeFQDIbN2S1pHWyxGbWbx IEBIRhmuboSjF/GkSZyv7gu0TqRyenYLN3FSpaEagBdFMFRse3qviMihwmQRJnCPxXXQV/WtT29 knEWUagxJ0iONswEBEi5VTO1Z89616qTQ1yjg5Ek8dYjn2sBbUQalzyGvWLMvhQfjPsr2Cr5HAW 4JBsc9p1nSfkgW9/q0Tpdw9jeywlbPZc/Opj1TGs2O4cb6CM5yZ2/5XrOt/KRVE6W8HpgI9XLWS qFx4pneXubYgQNzfXGhvHghCtOMVzEbxKXuglzwditT55TSiVph+C2SgghbkmwLq85oVgGTRddX 4ntuI161FQeg== X-Google-Smtp-Source: AGHT+IHZ5GIdOAm+3i6wsPlO0wKqi+XJ0SMWscMhrypMvrTyemp7DnYCTfxuh1He5sd8t6NJRKP1qw== X-Received: by 2002:a05:600c:3b13:b0:477:952d:fc11 with SMTP id 5b1f17b1804b1-4792af1b157mr23545645e9.16.1764759808090; Wed, 03 Dec 2025 03:03:28 -0800 (PST) Received: from [192.168.2.32] ([165.225.27.7]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42e1ca1a38bsm39410974f8f.24.2025.12.03.03.03.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Dec 2025 03:03:27 -0800 (PST) Message-ID: Date: Wed, 3 Dec 2025 12:03:25 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc? To: Robert Haas , Lukas Fittl Cc: Andres Freund , Pavel Stehule , vignesh C , Michael Paquier , Ibrar Ahmed , Maciek Sakrejda , pgsql-hackers References: <20230123174158.rhmrbmjp6ycak64r@awork3.anarazel.de> <20230207181218.47irz3of34qsww5l@awork3.anarazel.de> <989acbcf-e950-7911-c2e2-fe7aa7d15108@gmail.com> <198ef658-a5b7-9862-2017-faf85d59e3a8@gmail.com> <20240601185200.riqzbabh5azna2fr@alap3.anarazel.de> <57845c37-85e8-4d0e-9456-76833e089c5d@gmail.com> Content-Language: en-US From: David Geier In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 19.11.2025 20:36, Robert Haas wrote: > On Wed, Nov 19, 2025 at 11:55 AM Lukas Fittl wrote: >> Overall, I'm still thinking a GUC might be the way to go, but I don't think anyone else was enthusiastic about that idea :) > > Reliable feature auto-detection is the best option, but if that's not > possible, I think the choices are add a GUC or give up on the project > altogether. Using a GUC to deal with platform dependencies is a pretty > reasonable concept -- see, e.g. dynamic_shared_memory_type or > huge_pages or io_method. If we can't autodetect it reliably and we > aren't willing to add a GUC, we're basically saying there's not enough > value here to justify adding a configuration parameter. That's often a > totally reasonable conclusion -- it can easily happen that the > benefits of a platform-specific optimization are too small to make it > worth configuring. But I would have thought that in this case the > benefits might be quite large. I'm also in favor of adding a GUC. Even if we could 100% reliably detect if using TSC is giving correct results, it could be that it's slow in some virtualized environment and hence the user wants to disable it. I'm wondering how to best do a GUC for something that is potentially unavailable on the system. In that case the GUC would be superfluous. Maybe a boolean "enable_try_fast_clocksource" GUC or a "clocksource" enum GUC which can be "default" and "try_rdtsc", where we only include the "try_rdtsc" enum value on x86 systems? Any other ideas? -- David Geier