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 1uzPZ3-003Bw0-0d for pgsql-performance@arkaria.postgresql.org; Fri, 19 Sep 2025 01:05:29 +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 1uzPZ1-002xNf-I6 for pgsql-performance@arkaria.postgresql.org; Fri, 19 Sep 2025 01:05:27 +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 1uzPZ1-002xNW-7f for pgsql-performance@lists.postgresql.org; Fri, 19 Sep 2025 01:05:27 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uzPYx-001bH1-1i for pgsql-performance@lists.postgresql.org; Fri, 19 Sep 2025 01:05:26 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5679dbcf9d8so1526310e87.0 for ; Thu, 18 Sep 2025 18:05:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758243924; x=1758848724; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=AbkBH6ySe5NXeKxDyKEeh6anudr02OLvLOD4z6A2Wu4=; b=GeHBtMmNh+XrsLd6/Z8wE4TdJ/UjiZFDrzgkScEsBYZ6QHaXqvQX74f+gfzE3iz1qA jsJF+1EaKCdDuX8EiyGUphg/+7NtTlFsFQ3v5iAfOHM8s9Zy2BvyenKLck3+tQd32EuS V9Sn1/f48nNGfOUzbi/kyKW01qFO4rMTAp3nTNQVMmVqnaVH3dXJ8xRAxD99f7yimQTl WBwZDVL9e0mjGYaqVIXkwK8kWf/ve2SSsQUqQWAI3Btd8HCumdZZoIq+FY3sdBcaOnQG yfvLrpDxRxh3QH+1E5TvFLhQlULKz1BmWUmnMcZ+koY+zQvUXNpgbIJObf+3OCglqY4w m66Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758243924; x=1758848724; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AbkBH6ySe5NXeKxDyKEeh6anudr02OLvLOD4z6A2Wu4=; b=NrBJ+GnHRxYBlpgSDll3xLO7EFhq2VOAYusIgpUJ4IhIydWL+VPIqNb/gYJQ+C+OqO 3fwnKAKmY4uIfZNCH7t/n9R4hBTO2p9P3PCzqDzEcHJ5zRHdZmAxCtrGjPfgoQANEMK6 auAqkBGDg9sX93gIGPVPtUl0uJsujfOg0yTGiVpuad2yqHihT2WE6r/tp3cDyuhT36tt pRxCcY8XpYMvoHyaLiOEbtJC/fZJhBAvQNeH53IKaEg3nMnnOsBaYRDmKqydGCNVEfod s5iBcyTwOJFQsLgkmVJO6qQuxgIv5+/nGizqzOzJJUjKQDs/mjQc1rYAiD670gA43I6F gQ2w== X-Forwarded-Encrypted: i=1; AJvYcCUolRwfxtntJx/erVU5tUNlVMz4CudluhdLY7gjfKK78ST+dDM2O5PCv79DHPL8HvsgOhnE41Q9A6Ssqt9YLFYxgA==@lists.postgresql.org X-Gm-Message-State: AOJu0YzRV/e1OiOpozKy7OGT5+3bISTqw/CGAZszEs1yUNfF68/h1cb4 B2/I+dV8bQRU4JgGkmf8Yc3hcjiwKWUb/jVz/qjDpArGnKJZ15cbvL3Qq1xmFxj4+L7SjQbG3FY KG7p1ba7M1YFc03Yx82fQd4S774CtBIg= X-Gm-Gg: ASbGncvfPJ+Y4v70S179/qPfJ+ea5XLdURVxyAANG2It8vJzVDaHem1h+EYSruUZKZq AxhWoemXazss2y7/GxN+z+NYepa7Qhs4tNc0mm5kqkKj35u7w6YiXBOeCiJxJCz2uU0iy1Z93Ds KRpBbwa3Jfrde8pfma6YTFL4QloKdLF2dUGxA8fOstnMkwKarxwYizTvDiTpvExB+yBlYrTjRiJ 2eGaJLMKrYyQafoIBgJBPr2IOlaaJ16mqnJhv0/2Q== X-Google-Smtp-Source: AGHT+IEgeYXVi4UlonvEBtUe7aaoeqQ80gp9KN+VgBo3KFULee1ntEbL1PdUnQg9ICw0jDZZJcZY0Un73jBjxE6W2/g= X-Received: by 2002:a05:6512:3096:b0:571:8c5d:1761 with SMTP id 2adb3069b0e04-579dfccaddcmr495123e87.1.1758243923665; Thu, 18 Sep 2025 18:05:23 -0700 (PDT) MIME-Version: 1.0 References: <8f25c08c-acb2-47ca-b8c1-6664fc31a361@thefreecat.org> <32dc1fe9-175a-4894-b4c4-c6cdc6a76a16@gmail.com> In-Reply-To: From: David Rowley Date: Fri, 19 Sep 2025 13:05:11 +1200 X-Gm-Features: AS18NWDDe6AzDRuw93c51FW6FvKNJfr8UtnExr5zZsEwow9neBqg6rSC1RCHYOc Message-ID: Subject: Re: Why isn't PG using an index-only scan? To: Andrei Lepikhov Cc: Jean-Christophe BOGGIO , "pgsql-performance@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 18 Sept 2025 at 23:55, Andrei Lepikhov wrote: > It looks like a makeshift solution. By implementing a callback, we could > elevate 'interrupter' to a first-class feature, enabling us to monitor > the state of the entire query tree (it is especially cool in EXPLAIN > ANALYZE mode when we may be OK with a partial result). > What's more interesting if Robert's work on nodes' extensibility > successes, it enables modules to save planning decisions in the plan. > Thereby, the in-executor callback provides a means to kick off the query > planned with incorrect estimations (e.g., too many spilled tuples). > > Perhaps we should start working on introducing this type of callback/ hook? I don't really have a fully formed opinion here, but I expect that if there is something that needs a new hook function, it might be easier to convince everyone that it's a good idea to accept that change if you first write a patch to add the hook, then go off and write the extension that uses it and then come back with that as evidence that the hook is useful enough to be committed to core. There's certainly places where you could add a hook that would just add an unacceptable overhead that we couldn't stomach. I expect ExecProcNode would be one of those places. I do agree that trying to come up with something for this is worthy of some time and effort. Helping people with performance issues when they can't even get EXPLAIN ANALYZE to finish is quite tricky. David