Re: small table left outer join big table - Mailing list pgsql-hackers

From Robert Haas
Subject Re: small table left outer join big table
Date
Msg-id AANLkTim77uhiyCkfTfUW2Az47EtM163ztTk1eSOC+nFg@mail.gmail.com
Whole thread Raw
In response to Re: small table left outer join big table  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: small table left outer join big table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Dec 29, 2010 at 7:34 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> On Wed, 2010-12-29 at 07:17 -0500, Robert Haas wrote:
>> >
>> > Here I have a puzzle, why not choose the small table to build hash table? It
>> > can avoid multiple batches thus save significant I/O cost, isn't it?
>>
>> Yeah, you'd think.  Can you post a full reproducible test case?
>
> It's not a bug, that's the way it currently works. We don't need a test
> case for that.
>
> I agree that the optimisation would be a useful one.
>
> It allows you to ask the query "Show me sales for each of my stores"
> efficiently, rather than being forced to request the inner join query
> "Show me the sales for each of my stores for which there have been
> sales", which is a much less useful query.

Oh, you're right.  I missed the fact that it's a left join.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Avoiding rewrite in ALTER TABLE ALTER TYPE
Next
From: Aidan Van Dyk
Date:
Subject: Re: pg_dump --split patch