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.94.2) (envelope-from ) id 1uz9Uq-00HPeN-FO for pgsql-performance@arkaria.postgresql.org; Thu, 18 Sep 2025 07:56:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uz9Uo-00EeYa-Tk for pgsql-performance@arkaria.postgresql.org; Thu, 18 Sep 2025 07:56:02 +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.94.2) (envelope-from ) id 1uz9Uo-00EeYL-Gc for pgsql-performance@lists.postgresql.org; Thu, 18 Sep 2025 07:56:02 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uz9Uk-001T6v-0P for pgsql-performance@lists.postgresql.org; Thu, 18 Sep 2025 07:56:01 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-45f31adf368so4421695e9.3 for ; Thu, 18 Sep 2025 00:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758182158; x=1758786958; darn=lists.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=t8xSsP5TpJf09Sh850HOkHqkzcTl+Q/iU5mj9/n2zT0=; b=R7+8suRg1d0Cwpra1w57ovGjaXtLen1slr8ukokw8L6dGankFhPNmRLp4cbchecdM/ kwJfLXCMuLMscqKxQd6XEqRtyOhcta3f6Pc6sz3kamMmyP0xwopHhbmLim6J+vT/3ITE cSgpFFgNTskgNDRYmVPMvPyeiKGSuO8I8W0/0xhe/8DueqsjRglNhoE1f+oOj+yAMOPq TtBSYw5T3m5dyLcaOYZjDMA+mUK3XUpVjvivuw9yboFjUXRGFA8FTtGgmERynjwtDiEd LHcvNVJ5GjyCRoq2qq+0dPVTBT0hXFEZfap5ySHr2HctcdySKZH1zN2hBxGKxyv1hRJ5 a3Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758182158; x=1758786958; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t8xSsP5TpJf09Sh850HOkHqkzcTl+Q/iU5mj9/n2zT0=; b=tgQCk8IxzAQ0fmz7nGkmWGfhXrtOS7KcIdQAw2vIPZxlEjJ46KxtiM7VPJzUYzcIe3 WvvQ5FURaQ7ySjEukkQtrbPwNZkwKX/br+lT+s+t9a4+Oc8ao4yU0yHXg0WhQuvma1nP Gck/nlQaCHKWPEI+he6SH/YWaH+12/M7OVwuzxCIq2G7N9EHRKKZb4w2JQYKc0NIGOUM rfUl+lyk8xJUhn+G6FFiVutJQmD8/Q7mxnljq5oHhTOtyfVSaoKhlnqg2jyUQAVjtPf3 POF3rGACjL4tSSC7KPxs8s1drZIARnI7YKvRIfDdqjorVEL/gAkM6sJ3u3uTnVPeQ3KW PjfQ== X-Gm-Message-State: AOJu0YziCDE1a01aUxbn0yVvnScXIHdFNRL3AIMLknft7rrY5haL6a/F LlXkUGG2Mmae1W+d+i9Ryvxc9tmUDjf/cUusnVuF6DvNxH1YKZrxakkL X-Gm-Gg: ASbGncuseY8hhc6UCtPb1IF1uU4NHSg2XnbzugmYgiHMx94Bdgp1P4BD6Rc2BiqErmh nTapUk/1t2YpetkUzJJGJGKhq+pEbQHojSuLM4i6KWHpme08Qiz1p5AldFrp2jHt/+5cXkd1Py5 F7cy61XrK07Vpg6CMj9ttm+iNBZ9nsz5IaAdIAVzcP6u5VFJ70LBSKQS/oo3wOXQSAMwW2zxz1r LHk1COs7N73AAUAVCdZqWHHa2KsRzwIlzpL0CmnlUbP+t2B2muvGiTZrnYlp6HPYXLGEM7dtKDG OTjITyOeQYD6SqWlEK5CxX+DZ4KcCi2/R33xAWACe5zI0ZLLOohAPw6noLeesxhKAW8hmYiMgDy helalAuSNaAJUqocy4TGRdOCA7NBLPzNovZmYrp6g0+gWlFl1GG82 X-Google-Smtp-Source: AGHT+IEussJ9AkzwTifLkJHANzvqOWPCttcwBLQwxvVh8avAIyYZ3lBQ/vR2MWstUkYDUMJA2VOFmw== X-Received: by 2002:a05:600c:470a:b0:45d:d19c:32fc with SMTP id 5b1f17b1804b1-4620291a37bmr51759565e9.10.1758182158087; Thu, 18 Sep 2025 00:55:58 -0700 (PDT) Received: from [192.168.15.124] ([80.251.191.198]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46566f72354sm20817895e9.3.2025.09.18.00.55.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Sep 2025 00:55:57 -0700 (PDT) Message-ID: <32dc1fe9-175a-4894-b4c4-c6cdc6a76a16@gmail.com> Date: Thu, 18 Sep 2025 09:55:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Why isn't PG using an index-only scan? To: David Rowley , Jean-Christophe BOGGIO Cc: "pgsql-performance@lists.postgresql.org" References: <8f25c08c-acb2-47ca-b8c1-6664fc31a361@thefreecat.org> Content-Language: en-US From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 18/9/2025 09:20, David Rowley wrote: > On Thu, 18 Sept 2025 at 18:36, Jean-Christophe BOGGIO > If it still takes a long time, you might try SET enable_mergejoin = 0; > and run the EXPLAIN ANALYZE SELECT .. part. That'll at least give us > more accurate row counts of what we're actually working with.This appears to be a good example of a missing feature: the in-execution callback or hook. Imagine if we had a hook within the ExecProcNode. In that scenario, we could create a trivial extension that would stop the query after, let's say, 10 minutes of execution and display the current state. This would give us more reliable data on estimation and the state of the plan tree. What are your thoughts? -- regards, Andrei Lepikhov