From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Planner reluctant to start from subquery
Date: Wed, 01 Feb 2006 14:24:39 -0600
Message-ID: <43E0C4A7.EE98.0025.0@wicourts.gov> (raw)
In-Reply-To: <4218.1138824885@sss.pgh.pa.us>
References: <43E0AA7E.EE98.0025.0@wicourts.gov>
<43E0AA7E.EE98.0025.0@wicourts.gov>
<3759.1138822464@sss.pgh.pa.us>
<43E0BEDD.EE98.0025.0@wicourts.gov>
<43E0BEDD.EE98.0025.0@wicourts.gov>
<4218.1138824885@sss.pgh.pa.us>
>>> On Wed, Feb 1, 2006 at 2:14 pm, in message
<4218.1138824885@sss.pgh.pa.us>,
Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
>> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> ... expected an equivalent IN clause to work better. In fact, I'm
not
>>> clear why the planner isn't finding the cheapest plan (which it
does
>>> estimate as cheapest) from the IN version you posted.
>
>> All I know is that trying various permutations, I saw it pick a
good
>> plan for the IN format when I eliminated the last outer join in the
FROM
>> clause. I know it isn't conclusive, but it was a correlation which
>> suggested a possible causality to me.
>
> But there is still an outer join in your third example (the one with
the
> best plan), so that doesn't seem to hold water.
Right, if I moved the DocImageMetaData from a subquery in the WHERE
clause up to the FROM clause, or I eliminated all OUTER JOINs, it chose
a good plan. Of course, this was just playing with a few dozen
permutations, so it proves nothing -- I'm just sayin'....
> In any case, the way
> that IN planning works these days it really should have considered
the
> plan equivalent to your JOIN- against- GROUP- BY variant.
>
> I'm interested to poke at this ... are you in a position to provide
a
> test case?
I can't supply the original data, since many of the tables have
millions of rows, with some of the data (related to juvenile, paternity,
sealed, and expunged cases) protected by law. I could try to put
together a self-contained example, but I'm not sure the best way to do
that, since the table sizes and value distributions may be significant
here. Any thoughts on that?
-Kevin
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: Kevin.Grittner@wicourts.gov, tgl@sss.pgh.pa.us
Subject: Re: Planner reluctant to start from subquery
In-Reply-To: <43E0C4A7.EE98.0025.0@wicourts.gov>
References: <43E0AA7E.EE98.0025.0@wicourts.gov> <3759.1138822464@sss.pgh.pa.us> <43E0BEDD.EE98.0025.0@wicourts.gov> <4218.1138824885@sss.pgh.pa.us> <43E0C4A7.EE98.0025.0@wicourts.gov>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox