From: | Tony Theodore <tony(dot)theodore(at)gmail(dot)com> |
---|---|
To: | Tim Uckun <timuckun(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Why is this a cross join? |
Date: | 2013-02-17 22:22:26 |
Message-ID: | D3884E3C-7DC5-475E-BCE9-2F6E6354A46A@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 18/02/2013, at 9:09 AM, Tim Uckun <timuckun(at)gmail(dot)com> wrote:
>>
>> In some way, every join is a cross join, with the results filtered according to the specificity of the join conditions. In this case:
>>
>> inner join model_configurations mc on left(crm.customer_class, 6) = left(mc.sap_code,6)
>>
>> "customer_class" sounds like a fairly generic sort of field, so you'd expect many matches. Truncating the fields is likely to make this even less specific, returning more results.
>>
>
> I guess I am not explaining it properly..
>
> 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?
No, it would be no different if you created new columns - the join condition is the same.
You're not actually getting a cross join, that would be many more records than 9million - you're just not setting a specific enough filter.
Cheers,
Tony
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2013-02-17 22:41:36 | Re: Why is this a cross join? |
Previous Message | Adrian Klaver | 2013-02-17 22:17:05 | Re: Why is this a cross join? |