public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andrei Lepikhov <[email protected]>
To: David Rowley <[email protected]>
Cc: Jean-Christophe BOGGIO <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Why isn't PG using an index-only scan?
Date: Thu, 18 Sep 2025 13:55:02 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAApHDvodjGfmN8_na70Bn5OVPO1-gQo64s6n=HUxqnUUQFsUZA@mail.gmail.com>
References: <[email protected]>
	<CAApHDvoUdvw68oHnfACQE=u8XPJ+Te49dZsfC2yW+DVfzdT2+Q@mail.gmail.com>
	<[email protected]>
	<CAApHDvodjGfmN8_na70Bn5OVPO1-gQo64s6n=HUxqnUUQFsUZA@mail.gmail.com>

On 18/9/2025 13:35, David Rowley wrote:
> On Thu, 18 Sept 2025 at 19:55, Andrei Lepikhov <[email protected]> wrote:
>> 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.
> 
> I recall something along those lines existing once in the extension
> world. Or maybe just from a previous employer. I don't recall many of
> the details. Maybe something like a function you pass an SQL string
> and if you cancelled the query it reported the EXPLAIN ANALYZE done so
> far. I assume it must have done something like LOG it as it couldn't
> have shown the EXPLAIN as query results on cancel.
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?

-- 
regards, Andrei Lepikhov





view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Why isn't PG using an index-only scan?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox