Re: Why is this a cross join?

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Why is this a cross join?
Date: 2013-02-17 22:41:36
Message-ID: 51215CA0.5020400@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/17/2013 2:09 PM, Tim Uckun wrote:
> Say I created new columns on both tables called "first_6" and
> populated them with the substrings. If I did a inner join or a left
> join on those fields would I still get a cross join?
>
> inner join model_configurations mc on mc.first_6 = crm.first_6

without additional filtering, that will return a row for every row in
crm that matches a row in mc. if there's a 1000 rows in crm that each
match an average of 6 rows in mc, that would return 6000 rows.

crm left join mc would return all of those, plus all the rows in crm
that don't have any match in mc (the mc.* fields would be NULL in these
result rows).

--
john r pierce 37N 122W
somewhere on the middle of the left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Harris 2013-02-18 03:31:32 Re: Hot Standby has PANIC: WAL contains references to invalid pages
Previous Message Tony Theodore 2013-02-17 22:22:26 Re: Why is this a cross join?