Re: Avoiding sequential scans with OR join condition - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Avoiding sequential scans with OR join condition
Date
Msg-id 20041018141939.GA21047@wolff.to
Whole thread Raw
In response to Re: Avoiding sequential scans with OR join condition  (Mike Mascari <mascarm@mascari.com>)
List pgsql-general
On Sun, Oct 17, 2004 at 03:30:32 -0400,
  Mike Mascari <mascarm@mascari.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.

pgsql-general by date:

Previous
From: Christopher Browne
Date:
Subject: Re: 8.0.0beta3 vacuum analyze
Next
From: "Lada 'Ray' Lostak"
Date:
Subject: Online system & transactions