Re: Avoiding sequential scans with OR join condition

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: Sim Zacks <sim(at)compulab(dot)co(dot)il>, pgsql-general(at)postgresql(dot)org
Subject: Re: Avoiding sequential scans with OR join condition
Date: 2004-10-18 14:19:39
Message-ID: 20041018141939.GA21047@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Oct 17, 2004 at 03:30:32 -0400,
Mike Mascari <mascarm(at)mascari(dot)com> wrote:
>
> I'm thinking that the WHERE clauses condition should read:
>
> WHERE l1.p_pkey is not null OR l2.p_key is not null;

That seems to make more sense. I was puzzling about that condition myself.
If both keys where not null, there wouldn't even be a need for "left" joins.

Note that the output is different than you were originally getting as
well, since previously rows looked like one big table row combined with
one little table row. Now you are getting one big table row combined with
two little table rows (one of which might be null). This is probably
still faster, but you will need to change how you use the output.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lada 'Ray' Lostak 2004-10-18 15:11:55 Online system & transactions
Previous Message Christopher Browne 2004-10-18 12:49:42 Re: 8.0.0beta3 vacuum analyze