Why does this query create a MERGE JOIN CARTESIAN in Oracle?

Here is my request:

select count(*)
from email_prod_junc j
inner join trckd_prod t5 on j.trckd_prod_sk = t5.trckd_prod_sk
inner join prod_brnd b on t5.prod_brnd_sk = b.prod_brnd_sk
inner join email e on j.email_sk = e.email_sk
inner join dm_geography_sales_pos_uniq u on (u.emp_sk = e.emp_sk and u.prod_brnd_sk = b.prod_brnd_sk)

The plan of explanation says:

Cartesian relationship between DM_GEOGRAPHY_SALES_POS_UNIQ and EMAIL_PROD_JUNC.

I do not understand why, because there is a join condition for each table.

+5
source share
3 answers

I solved this by adding an ORDERED hint:

select /*+ ordered */

I got information from here

If you specify the tables in the order that you want to join, and use this hint, Oracle will not waste time looking for the optimal join order, it just joins them because they are ordered in the FROM clause.

+5
source

, , . , EMAIL_PROD_JUNC DM_GEOGRAPHY_SALES_POS_UNIQ TRCKD_PROD (trckd_prod_sk, prod_brnd_sk). , , , , TRCKD_PROD .

+1

, - on (x y) . Oracle, , , , , . Oracle, ,

Edit

, :

inner join dm_geography_sales_pos_uniq u on u.emp_sk = e.emp_sk 
where u.prod_brnd_sk = b.prod_brnd_sk

and see if this removes the full connection from the plan

0
source

All Articles