Re: Improving non-joinable EXISTS subqueries

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Improving non-joinable EXISTS subqueries
Date: 2008-08-21 01:13:19
Message-ID: 603c8f070808201813m2f974e5fi9cad591c95ada913@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marcelo Martins 2008-08-21 03:58:03 postgres-R
Previous Message Kevin Grittner 2008-08-20 22:47:57 Re: Improving non-joinable EXISTS subqueries