Re: Improving non-joinable EXISTS subqueries - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Improving non-joinable EXISTS subqueries
Date
Msg-id 603c8f070808201813m2f974e5fi9cad591c95ada913@mail.gmail.com
Whole thread Raw
In response to Re: Improving non-joinable EXISTS subqueries  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> Another technique that we could play with is to have the
> AlternativeSubPlans node track the actual number of calls it gets,
> and switch from the "retail" implementation to the "hashed"
> implementation if that exceeds a threshold.  This'd provide some
> robustness in the face of bad estimates, although of course it's
> not optimal compared to having made the right choice to start with.

Ideally you'd want to set that threshold dynamically.  If you expect x
calls and midway through execution notice that you're already up to 2x
calls, the right thing to do depends a lot on whether you're 1% done
or 99% done.

Logic of this type also opens a bit of a can of worms, in that there
are probably many other situations in which it's possible to notice
that your estimates are off and shift gears in mid-query, but how much
are you willing to slow down the queries where there isn't a problem
to speed up the ones where there is?

...Robert


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Improving non-joinable EXISTS subqueries
Next
From: Marcelo Martins
Date:
Subject: postgres-R