Why is this a cross join?

From: Tim Uckun <timuckun(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Why is this a cross join?
Date: 2013-02-17 08:16:16
Message-ID: CAGuHJrPecBtn_OjXkXYmJOJycZcJNhnLjW7k-GViC8Jto4YSMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a seemingly simple query that returns way too many records.
Here is the count query

select count(*) from (
select crm.*
from sap_crm_sales crm
inner join model_configurations mc on left(crm.customer_class, 6)
= left(mc.sap_code,6)
) as s

The crm table has about 44K records, the model table has about 1K the
join produces about 9 million records

It doesn't matter if I make it a left join or inner join the count
ends up the same.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2013-02-17 10:30:06 Re: Why is this a cross join?
Previous Message Tiemo Kieft 2013-02-17 08:02:29 Streaming replication and sharding