is "join Cartesian" identical "merge join Cartesian"?
Hi guys,.my plan to explain said the Cartesian merge join
[Oracle documentation | http://download-west.oracle.com/docs/cd/B10500_01/server.920/a96533/optimops.htm#45485] speaks of Cartesian join
Are these two the same?
Thank you
Hello
Both are the same but the NAP differs from 9i to 10g, since according to the algorithm basedon Version in! 0 g's
Kind of buffer.
Look at the example of wirh links.
http://www.juliandyke.com/optimisation/operations/MergeJoinCartesian.html
http://www.akadia.com/services/ora_interpreting_explain_plan.html
-Pavan Kumar N
Tags: Database
Similar Questions
-
Hi all
I have a problem in writing the query below. The following query always shows a MERGE JOIN CARTESIAN in the plan to explain due to which the execution of the query takes a long time (almost 2 hours for 1,000 records).
I use "Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi. Please advice if I need to provide more information on that.
-----Select to_char(a.amnt_date,'DD-MON-YYYY') amnt_date, SUM(a.AMNT_CON) amount from amount a, (SELECT area_no FROM (SELECT * FROM area_usage WHERE area_hier_no = '201064') CONNECT BY area_par_no = PRIOR area_no START WITH area_no in (SELECT area_no FROM area WHERE area_code in ('EQ'))) b, (SELECT acc_no FROM (SELECT * FROM acc_usage WHERE acc_hier_no = '1') CONNECT BY acc_par_no = PRIOR acc_no START WITH acc_no = 202917) c -- Account Hierarchy where a.area_no = b.area_no AND a.acc_no = c.acc_no GROUP BY a.amnt_date
PLAN_TABLE_OUTPUT
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hash value of plan: 2492729134
-----------------------------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time | Pstart. Pstop |
-----------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | 692. 22144 | 3327 (32) | 00:00:40 |
| 1. HASH GROUP BY. 692. 22144 | 3327 (32) | 00:00:40 |
| 2. TABLE ACCESS BY LOCAL INDEX ROWID | AMOUNT | 138. 2898. 3326 (32) | 00:00:40 |
| 5: NESTED LOOPS | 692. 22144 | 3326 (32) | 00:00:40 |
| 4. THE CARTESIAN MERGE JOIN. 5. 55. 13 (0) | 00:00:01 |
| 5. VIEW | 1. 5. 5 (0) | 00:00:01 |
|* 6 | CONNECT BY WITH FILTERING |
| 7. TABLE ACCESS BY INDEX ROWID | ACC_USAGE | 1. 24. 2 (0) | 00:00:01 |
|* 8 | INDEX UNIQUE SCAN | ACU_PK | 1 | | 1 (0) | 00:00:01 |
| 9. NESTED LOOPS |
| 10. CONNECT PUMP |
| * 11 | TABLE ACCESS BY INDEX ROWID | ACC_USAGE | 1. 14. 5 (0) | 00:00:01 |
| * 12 | INDEX RANGE SCAN | ACU_AH_HAVE_AS_PARENT_FK_I | 4 | | 1 (0) | 00:00:01 |
| 13. KIND OF BUFFER. 5. 30. 13 (0) | 00:00:01 |
| 14. VIEW | 5. 30. 8 (0) | 00:00:01 |
| * 15 | CONNECT BY WITH FILTERING |
| * 16. TABLE ACCESS BY INDEX ROWID | AREA_USAGE |
| 17. NESTED LOOPS | 1. 32. 2 (0) | 00:00:01 |
| 18. TABLE ACCESS BY INDEX ROWID | AREA | 1. 21. 2 (0) | 00:00:01 |
| * 19. INDEX UNIQUE SCAN | AR_AR2_UK | 1 | | 1 (0) | 00:00:01 |
| * 20. INDEX UNIQUE SCAN | AU_PK | 8608. 94688 | 0 (0) | 00:00:01 |
| 21. NESTED LOOPS |
| 22. CONNECT PUMP |
| * 23. TABLE ACCESS BY INDEX ROWID | AREA_USAGE | 5. 85. 8 (0) | 00:00:01 |
| * 24. INDEX RANGE SCAN | ARU_APN_FKI | 8 | | 1 (0) | 00:00:01 |
| 25. RANGE OF PARTITION ALL THE | 1. 60.
| 26. CONVERSION OF BITMAP IN ROWID |
| 27. BITMAP AND |
| 28. CONVERSION OF BITMAP OF ROWID |
| * 29. INDEX RANGE SCAN | A_ARH_FK_I | 194K | 134 (7) | 00:00:02 | 1. 60.
| 30. CONVERSION OF BITMAP OF ROWID |
| * 31. INDEX RANGE SCAN | A_AH_FK_I | 194K | 488 (41) | 00:00:06 | 1. 60.
-----------------------------------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
6 - access("ACC_USAGE".") ACC_PAR_NO "="ACC_USAGE"ADVANCE." ACC_NO")
8 - access("ACC_USAGE".") ACC_NO "= 202917 AND ACC_HIER_NO" = 1) «»
11 - filter ("ACC_HIER_NO" = 1)
12 - access("ACC_USAGE".") ACC_PAR_NO "="ACC_USAGE"ADVANCE." ACC_NO")
15 - access("AREA_USAGE".") AREA_PAR_NO "="AREA_USAGE"ADVANCE." AREA_NO')
16 - filter ("AREA_HIER_NO" = 201064)
19 - access ("AREA_CODE" = 'EQ')
20 - access ("AREA_HIER_NO"= "AREA_USAGE" AND 201064." AREA_NO "=" AREA_NO")
23 - filter ("AREA_HIER_NO" = 201064)
24 - access("AREA_USAGE".") AREA_PAR_NO "="AREA_USAGE"ADVANCE." AREA_NO')
29 - access("A".") AREA_NO '=' B '. ("' AREA_NO")
31 - access("A".") ACC_NO '=' C '. ("' ACC_NO")
54 selected lines.
Published by: Williams James Henderson on October 14, 2010 05:31It is a very small difference, and I don't expect to cause huge changes in an execution plan. Either way to collect statistics, you would use the DBMS_STATS package.
Furthermore, your "formatted" execution plan is not exactly readable in your message.
Looking at your request a little more closely, I recommend you remove the SELECT * from subqueries. Something like that may be sufficient:
Select to_char(a.amnt_date,'DD-MON-YYYY') amnt_date, SUM(a.AMNT_CON) amount from amount a, (SELECT area_no FROM (SELECT area_no , area_par_no FROM area_usage WHERE area_hier_no = '201064') CONNECT BY area_par_no = PRIOR area_no START WITH area_no in (SELECT area_no FROM area WHERE area_code in ('EQ'))) b, (SELECT acc_no FROM (SELECT acc_no , acc_par_no FROM acc_usage WHERE acc_hier_no = '1') CONNECT BY acc_par_no = PRIOR acc_no START WITH acc_no = 202917) c -- Account Hierarchy where a.area_no = b.area_no AND a.acc_no = c.acc_no GROUP BY a.amnt_date
A SELECT statement using * and not at a later time using all the columns hides valuable information from Oracle. If you provide only the columns used Oracle may be able to find a better plan of execution.
Given that I don't know the structures of table if you can actually use all the columns. I still recommend the amendment because I think that it makes the code easier to understand.
-
Is the merge join Cartesian intensibe more CPU than nested loops?
Hello
just wonderning which access method is more intensive CPU, supposed to leave we got 2 the same rank sources and make joing via merge join Cartesian and then case is nested loop.
I know that nl can be CPU due to the tight loop access, but what abour MJC?
I can see bufferd sort but not sure is that cpu friendly?
Concerning
GregGThe simplest answer I think is "it depends on the situation." Two of them could be disaster in different situations. Nested loops are suitable for a type of join and Cartesian for another.
-
the group causing a Cartesian merge join?
Hi all
I wrote a query that runs in less than a second and produced a few hundred lines (as you can see below). I wanted only to find the number of separate incidents ID returned so I put a group by at the end and it ran forever.Database Version: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi Database Version: PL/SQL Release 10.2.0.5.0 - Production
I realized a plan to explain (as shown below) to the query with the group inside and he tries to make a Cartesian join!
A WTF happening? I've never known a group by statement before.
basic structure of the tables is the following:
the SQL statementSQL> desc answer_master Name Null? Type ------------------------------------------------------------------------ -------- ----------------- ANSWER_ID NOT NULL NUMBER(12) INCIDENT_ID NOT NULL NUMBER(12) PLAN_ID NOT NULL NUMBER(12) QUESTION_ID NOT NULL NUMBER(12) SQL> desc question_master Name Null? Type ------------------------------------------------------------------------ -------- ----------------- QUESTION_PLAN_ID NOT NULL NUMBER(12) QUESTION_ID NOT NULL NUMBER(12) QUESTION_TYPE NOT NULL NUMBER(2) QUESTION_TEXT NOT NULL VARCHAR2(255) QUESTION_PARENT_ID NUMBER(12)
Edit: change superiors--more/less to signs of! = to display the ForumSQL> explain plan for 2 select incident_id 3 from answer_master am 4 where exists (select 'x' 5 from answer_master am1 6 where question_id in (select question_id 7 from question_master qms 8 where question_plan_id = 1477 9 and question_parent_id = 69067 10 and substr(question_text,-3) = 'PDF') 11 and am1.incident_id = am.incident_id) 12 and exists (select 'x' 13 from answer_master am1 14 where question_id in (select question_id 15 from question_master qms 16 where question_plan_id = 1477 17 and question_parent_id = 69067 18 and substr(question_text,-3) != 'PDF') 19 and am1.incident_id = am.incident_id); Explained. Elapsed: 00:00:00.01 SQL> set linesize 132; SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial')); PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 1710257923 ---------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 32 | 171 (6)| 00:00:01 | |* 1 | HASH JOIN RIGHT SEMI | | 1 | 32 | 171 (6)| 00:00:01 | | 2 | VIEW | VW_SQ_2 | 71 | 923 | 70 (5)| 00:00:01 | | 3 | NESTED LOOPS | | 71 | 3266 | 70 (5)| 00:00:01 | |* 4 | TABLE ACCESS BY INDEX ROWID | QUESTION_MASTER | 1 | 35 | 2 (0)| 00:00:01 | |* 5 | INDEX RANGE SCAN | QUESTION_MASTER_IX1 | 3 | | 1 (0)| 00:00:01 | |* 6 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX2 | 18731 | 201K| 68 (5)| 00:00:01 | | 7 | NESTED LOOPS | | 304 | 5776 | 100 (5)| 00:00:01 | | 8 | VIEW | VW_SQ_1 | 14 | 182 | 70 (5)| 00:00:01 | | 9 | HASH UNIQUE | | 14 | 644 | | | | 10 | NESTED LOOPS | | 14 | 644 | 70 (5)| 00:00:01 | |* 11 | TABLE ACCESS BY INDEX ROWID| QUESTION_MASTER | 1 | 35 | 2 (0)| 00:00:01 | |* 12 | INDEX RANGE SCAN | QUESTION_MASTER_IX1 | 3 | | 1 (0)| 00:00:01 | |* 13 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX2 | 18731 | 201K| 68 (5)| 00:00:01 | |* 14 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX3 | 22 | 132 | 2 (0)| 00:00:01 | ---------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("ITEM_2"="AM"."INCIDENT_ID") 4 - filter("QUESTION_PLAN_ID"=1477 AND SUBSTR("QUESTION_TEXT",-3)!='PDF') 5 - access("QUESTION_PARENT_ID"=69067) 6 - access("QUESTION_ID"="QUESTION_ID") 11 - filter("QUESTION_PLAN_ID"=1477 AND SUBSTR("QUESTION_TEXT",-3)='PDF') 12 - access("QUESTION_PARENT_ID"=69067) 13 - access("QUESTION_ID"="QUESTION_ID") 14 - access("ITEM_1"="AM"."INCIDENT_ID") 33 rows selected. Elapsed: 00:00:00.06 SQL> explain plan for 2 select incident_id 3 from answer_master am 4 where exists (select 'x' 5 from answer_master am1 6 where question_id in (select question_id 7 from question_master qms 8 where question_plan_id = 1477 9 and question_parent_id = 69067 10 and substr(question_text,-3) = 'PDF') 11 and am1.incident_id = am.incident_id) 12 and exists (select 'x' 13 from answer_master am1 14 where question_id in (select question_id 15 from question_master qms 16 where question_plan_id = 1477 17 and question_parent_id = 69067 18 and substr(question_text,-3) != 'PDF') 19 and am1.incident_id = am.incident_id) 20 group by incident_id; Explained. Elapsed: 00:00:00.00 SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial')); PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 1433543102 ----------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ----------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 98 | 77 (6)| 00:00:01 | | 1 | HASH GROUP BY | | 1 | 98 | 77 (6)| 00:00:01 | | 2 | NESTED LOOPS | | 1 | 98 | 76 (4)| 00:00:01 | | 3 | NESTED LOOPS | | 1 | 87 | 74 (5)| 00:00:01 | | 4 | NESTED LOOPS | | 1 | 81 | 72 (5)| 00:00:01 | | 5 | MERGE JOIN CARTESIAN | | 1 | 70 | 4 (0)| 00:00:01 | |* 6 | TABLE ACCESS BY INDEX ROWID | QUESTION_MASTER | 1 | 35 | 2 (0)| 00:00:01 | |* 7 | INDEX RANGE SCAN | QUESTION_MASTER_IX1 | 3 | | 1 (0)| 00:00:01 | | 8 | BUFFER SORT | | 1 | 35 | 2 (0)| 00:00:01 | |* 9 | TABLE ACCESS BY INDEX ROWID| QUESTION_MASTER | 1 | 35 | 2 (0)| 00:00:01 | |* 10 | INDEX RANGE SCAN | QUESTION_MASTER_IX1 | 3 | | 1 (0)| 00:00:01 | |* 11 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX2 | 18731 | 201K| 68 (5)| 00:00:01 | |* 12 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX3 | 22 | 132 | 2 (0)| 00:00:01 | |* 13 | INDEX RANGE SCAN | ANSWER_MASTER_QID_IX2 | 1 | 11 | 2 (0)| 00:00:01 | ----------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 6 - filter("QUESTION_PLAN_ID"=1477 AND SUBSTR("QUESTION_TEXT",-3)='PDF') 7 - access("QUESTION_PARENT_ID"=69067) 9 - filter("QUESTION_PLAN_ID"=1477 AND SUBSTR("QUESTION_TEXT",-3)!='PDF') 10 - access("QUESTION_PARENT_ID"=69067) 11 - access("QUESTION_ID"="QUESTION_ID") 12 - access("AM1"."INCIDENT_ID"="AM"."INCIDENT_ID") 13 - access("QUESTION_ID"="QUESTION_ID" AND "AM1"."INCIDENT_ID"="AM"."INCIDENT_ID") 31 rows selected. Elapsed: 00:00:00.00 SQL> spool off
Published by: WhiteHat on February 11, 2011 09:37In addition, if you are interested in rewriting so I think this might be an alternative (untested):
select am1.incident_id from answer_master am1 , question_master qms where am1.question_id = qms.question_id and qms.question_plan_id = 1477 and qms.question_parent_id = 69067 group by am1.incident_id having max(case when substr(qms.question_text,-3) = 'PDF' then 1 else 0 end) != min(case when substr(qms.question_text,-3) = 'PDF' then 1 else 0 end);
-
The XML parsing returns a Cartesian join
I have the following table:
CREATE A TEMP_XML OF THE SYS. XMLTYPE
TABLESPACE HPS_LND_DATA
VARRAY XMLDATA AS LOB STORE
(
ALLOW ONLINE STORAGE
8192 CHUNK
RETENTION
AVERAGE COMPRESSION
CACHE
INDEX)
TABLESPACE HPS_LND_DATA)
)
NOPARALLEL
/
Each record in the table has the following XML structure:
< c id = "MMLab" t = "2009-10-25 12:02:00 AM" >
< d >
< nv n = v 'BootRomVersion' = "1.1505" / >
< n nv v="1.6.25075.203"/ "ClientVersion" = >
< nv n = v "CurrentTime" = "2009-10-25 12:02:00 AM" / >
< nv n = v "LastRebootTime" = "09/10/2009 15:32:53" / >
< nv n = v 'CPUSpeed' = "297" / >
< nv n = v "ServiceID" = "" / >
< nv n = v 'AvailablePhysicalMemory"="17502208"/ >
< nv n = v 'AvailableVirtualMemory"="8519680"/ >
< nv n = v "AllocatedPhysicalMemory" = "22003712" / >
< nv n = v "AllocatedManagedMemory" = "2898136" / >
< nv n = v "CommittedHeapMemory" = "1511424" / >
< nv n = v "AllocatedHeapMemory" = "1387584" / >
< nv n = v 'HeapEfficiency' = '91' / >
< nv n = v "AvailableVideoMemory" = "5052864" / >
< nv n = v "DrivePresent" = "True" / >
< nv n = v "DiskSizeInMB" = "305082" / >
< nv n = v 'DiskFreeInMB' = "21369" / >
< nv n = v 'DvrSizeInMB' = "283648" / >
< nv n = v "PercentDvrFree" = "100" / >
/ < d: >
/ < c >
I am using the following query:
SELECT EXTRACT (object_value, ' /c/@id').getstringval () AS ID,)
To_date (EXTRACT (object_value, ' /c/@t').getstringval (),))
"(mm/dd/yyyy hh: mi: ss AM') AS TIMESTAMP,
EXTRACT (VALUE (li), ' /nv/@n').getstringval () AS xml_parm,)
VALUE (li). EXTRACT (' (/nv/@v').getstringval) AS xml_value, li.*)
OF temp_xml, TABLE (XMLSEQUENCE (EXTRACT (object_value, "/ c/d/nv"))) li
The application of works very well if I limit the output to a single record in the temp_xml table, but if I ask more than one record I get a Cartesian result, how can I fix?You shouldn't have to join here.
You can see from the output that is a mistake and you get a Cartesian product?
Or are you unnecessarily worry a MERGE JOIN CARTESIAN and a SORT of BUFFER in the execution plan?
-
Hello
I'm on Oracle 10.2.0.4.
I have a problem with a simple Cartesian join. Is it possible to have a Cartesian join? whether a table has data and another table has no data, I take a Cartesian join (no join condition), I want to see all records from a table and values NULL for columns from the other table.
For example
SQL > create table T1 (id number, emp_name varchar2 (30));
Table created.
SQL > create table T2 (sp_name varchar2 (10), sp_desc varchar2 (10));
Table created.
SQL > insert into T1 values (101, 'AAAAA');
1 line of creation.
SQL > insert into T1 values (102, 'BBBB');
1 line of creation.
SQL > insert into values of T2 ('TBT', 'Important');
1 line of creation.
SQL > insert into values of T2 ("XYZ", "Not good");
1 line of creation.
SQL > commit;
Validation complete.
SQL > select t1.id, t1.emp_name, t2.sp_desc
2 from t1, (select sp_name, sp_desc from t2 where sp_name = "OTC") t2;
ID EMP_NAME SP_DESC
---------- ------------------------------ ----------
AAAAA 101 Important
Important 102 BENAMER
SQL > select t1.id, t1.emp_name, t2.sp_desc
2 from t1, (select sp_name, sp_desc from t2 where sp_name = "ZZZ") t2;
no selected line
SQL >
In the second query (where no line is selected), I want to see all the records in the table T1 and NULL values in columns from the alias of table T2.
How can I do?
Thanks in advance
The ANSI syntax can help here.
Select t1.id, t1.emp_name, t2.sp_desc
from t1
outer join t2 left t2.sp_name = "OTC";
ID EMP_NAME SP_DESC
---------- ------------------------------ ----------
AAAAA 101 Important
Important 102 BENAMER
Select t1.id, t1.emp_name, t2.sp_desc
from t1
outer join t2 left t2.sp_name = "ZZZ";
ID EMP_NAME SP_DESC
---------- ------------------------------ ----------
AAAAA 101
BENAMER 102
Post edited by: Brian Bontrager
removed the unnecessary condition -
Difference between a CROSS JOIN and a Cartesian product of the noted comma?
Hello everyone,
Oracle version: Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit
OS: Linux Fedora Core 17 (x86_64)
I was practicing on recursive subquery factoring based on oracle examples available in the documentation
http://docs.Oracle.com/CD/E11882_01/server.112/e26088/statements_10002.htm#i2129904
I was working on an example that displays the hierarchy of each manager with related employees. Here's how
Which gives the desired resultWITH tmptab(empId, mgrId, lvl) AS ( SELECT employee_id, manager_id, 0 lvl FROM employees WHERE manager_id IS NULL UNION ALL SELECT employee_id, manager_id, lvl+1 FROM employees, tmptab WHERE (manager_id = empId) ) SEARCH DEPTH FIRST BY mgrId SET order1 SELECT LPAD(' ', lvl * 3, ' ') || empId AS empId FROM tmptab;
However, by chance, I noticed that if I put CROSS JOIN instead of put a comma between table names, the same query behaves differently.EMPID --------------------- 100 101 108 109 110 111 112 113 200 203 204 205 206 102 103 104 105 106 107 114 115 116 117 118 119 120 125 126 127 128 180 181 182 183 121 129 130 131 132 184 185 186 187 122 133 134 135 136 188 189 190 191 123 137 138 139 140 192 193 194 195 124 141 142 143 144 196 197 198 199 145 150 151 152 153 154 155 146 156 157 158 159 160 161 147 162 163 164 165 166 167 148 168 169 170 171 172 173 149 174 175 176 177 178 179 201 202 107 rows selected. SQL>
In other words, if instead of writing
I am writing. . . UNION ALL SELECT employee_id, manager_id, lvl+1 FROM employees, tmptab WHERE (manager_id = empId)
I get the following error message. . . UNION ALL SELECT employee_id, manager_id, lvl+1 FROM employees CROSS JOIN tmptab WHERE (manager_id = empId)
Any idea?ERROR at line 4: ORA-32044: cycle detected while executing recursive WITH query
Correct me if I'm wrong, but I remember, oracle supports as many JOIN CROSSROADS notation for Cartesian product (vector product =). For example
So if the two rated commas and CROSS JOIN have the same semantics, why do I get a cycle mentioned above cites recursive subquery factoring while the same query works pretty well with comma between table instead of CROSS JOIN names? Because if a cycle is detected (= current element ancestor) it means that the product with the CROSS JOIN notation produces duplicates which are absent in the result of the Cartesian product rated comma.SQL> WITH tmptab1 AS 2 ( 3 SELECT 'a1' AS colval FROM DUAL UNION ALL 4 SELECT 'a2' AS colval FROM DUAL UNION ALL 5 SELECT 'a3' AS colval FROM DUAL 6 ), 7 tmptab2 AS 8 ( 9 SELECT 'b1' AS colval FROM DUAL UNION ALL 10 SELECT 'b2' AS colval FROM DUAL 11 ) 12 SELECT t1.colval, t2.colval 13 FROM tmptab1 t1 CROSS JOIN tmptab2 t2; CO CO -- -- a1 b1 a2 b1 a3 b1 a1 b2 a2 b2 a3 b2 6 rows selected. SQL> LIST 13 13* FROM tmptab1 t1 CROSS JOIN tmptab2 t2 SQL> SQL> SQL> CHANGE /CROSS JOIN/, 13* FROM tmptab1 t1 , tmptab2 t2 SQL> SQL> SQL> LIST 1 WITH tmptab1 AS 2 ( 3 SELECT 'a1' AS colval FROM DUAL UNION ALL 4 SELECT 'a2' AS colval FROM DUAL UNION ALL 5 SELECT 'a3' AS colval FROM DUAL 6 ), 7 tmptab2 AS 8 ( 9 SELECT 'b1' AS colval FROM DUAL UNION ALL 10 SELECT 'b2' AS colval FROM DUAL 11 ) 12 SELECT t1.colval, t2.colval 13* FROM tmptab1 t1 , tmptab2 t2 SQL> SQL> / CO CO -- -- a1 b1 a2 b1 a3 b1 a1 b2 a2 b2 a3 b2 6 rows selected. SQL>
I would appreciate it if you could kindly shed some light.
Thanks in advance,
Kind regards
DariyooshHello
dariyoosh wrote:
... Oracle terminology could become really confusing. But once again, according to the online glossary, a Cartesian product is apparently regarded as a join
http://docs.Oracle.com/CD/E11882_01/server.112/e25789/glossary.htm?type=popup#CNCPT44493
>There is no doubt that a Cartesian product (also called cross join) is a join. If loops in a WITH recursive clause are detected after completing the joins, but before other conditions apply, the relevant question here is "what are the requirements to join?
In the ANSI syntax, the distinction is always clear. Join conditions occur in the... Clause WESELECT employee_id, manager_id, lvl + 1 FROM employees JOIN tmptab ON (manager_id = empId) -- Join condition ;
and other conditions occur in the WHERE (or HAVING or CONNECT BY) clause.
SELECT employee_id, manager_id, lvl + 1 FROM employees CROSS JOIN tmptab WHERE (manager_id = empId) -- NOT a join condition ;
In the joins of the former, it seems to be the case that any condition involving 2 or more tables (or the + indicator of outer join) is a condtion of join:
SELECT employee_id, manager_id, lvl + 1 FROM employees , tmptab WHERE (manager_id = empId) -- Join condition ;
-
Hello
I have a Cartesian join in my application somewhere, but how do I know which tables are guilty and how to fix it.
Thank youSelect count(*) from redemresponse rr, memredemption mr, member mem, memalias ma, accrual acl, ac02 ac2 where rr.partnerid =12 and batchrunid is null and rr.redemptionid = mr.memberredempid and mr.memberid = mem.memberid and mem.memberid = acl.memberid and ma.aliastype = 'code' and mem.memberid = ma.memberid and ac2.ace02 = acl.ace02 and ma.memberaliasid = acl.memberaliasid
SandyAs far as I can see, you have joined all the tables together. This does not mean that the joins are correct, but they are all connected.
What leads you to believe that you have a Cartesian product inthere somewhere? The number is higher than you expect? If so, then your expectations is wrong, or you have not properly attached tables. For example, I notince that you use my both to join in ac1 ac2. Although not terchnically incorrect, it makes me wonder if one of the joins is disabled somehow.
The best way to understand it, is to start with a table and slowly accumulate until you see where the count starts to go wrong.
John
-
Natural join of Table to herself out of Cartesian product
Hello
With
CREATE TABLE A)
an INTEGER,
b VARCHAR (15).
c DATE
);
INSERT IN A (a, b, c) VALUES (1, 'AAA', SYSDATE);
INSERT IN A (a, b, c) VALUES (2, 'BBBB', SYSDATE);
INSERT IN A (a, b, c) VALUES (3, 'CCCCC', SYSDATE);
CREATE VIEW A1
AS SELECT * FROM A
;
the query
SELECT
*
A.
NATURAL JOIN HAS
;
returning nine records - but
SELECT
*
A.
NATURAL JOIN A1
;
only three - which is what I expected.
Why the difference?
Tested in 11g. Where is the documentation pertaining to this particular aspect?
Thank you!
Report it as a bug, the correct result, it's the three ranks of result you can go back to giving has an alias, for example:
SQL > select * a natural join a and b;
A B C
---------- --------------- ---------
1 AAA 15 JULY 15
2 BBBB 15 JULY 15
3 CARTER 15 JULY 15
3 selected lines.
SQL > select * from a natural join.
A B C
---------- --------------- ---------
1 AAA 15 JULY 15
1 AAA 15 JULY 15
1 AAA 15 JULY 15
2 BBBB 15 JULY 15
2 BBBB 15 JULY 15
2 BBBB 15 JULY 15
3 CARTER 15 JULY 15
3 CARTER 15 JULY 15
3 CARTER 15 JULY 15
9 selected lines.
Run on 11.2.0.4 - but reproduced on 12.1.0.2
Concerning
Jonathan Lewis
-
Hello
I use OBIEE version 11.1.1.6.0. I created made dummy table and column in the physical layer. and join all the dimension table with this fact. but I don't know how the business model to deal with it. can someone help me to create a cross join?
Thank you
Published by: 968086 on October 30, 2012 12:59 AMFollow this link
http://www.rittmanmead.com/2009/08/Oracle-BI-EE-10-1-3-4-1-reporting-on-non-transactional-dimension-values-equivalence-of-outer-joins/Score pls help if
-
Join of two tables without Cartesian?
-------------------------------------------------------------------------------------------------------- SELECT BAGLANTIDATE, CABONE FROM SEDEF_BILGI WHERE CABONE = '1' AND BAGLANTIDATE BETWEEN TO_DATE('10-JUN-2009','DD,MON-YYYY') AND TO_DATE('11-JUN-2009','DD-MON-YYYY') -------------------------------------------------------------------------------------------------------- BAGLANTIDATE CABONE ------------------------- ---------- 10-JUN-09 03.01.52.546000000 AM 1 10-JUN-09 05.02.06.453000000 PM 1 10-JUN-09 01.01.20.421000000 PM 1 10-JUN-09 07.01.42.062000000 AM 1 10-JUN-09 09.44.59.515000000 AM 1 10-JUN-09 09.58.07.843000000 AM 1 10-JUN-09 09.01.50.546000000 PM 1 7 rows selected -----------------------------------------------------------------------------------------------------------
I need a code that will help me to show the 9 values in the following form----------------------------------------------------------------------------------------------------------- SELECT KAYITDATE, ABONE FROM GPRS_TB_SAYACISEMRI WHERE ABONE = '1' AND KAYITDATE BETWEEN TO_DATE('10-JUN-2009','DD,MON-YYYY') AND TO_DATE('11-JUN-2009','DD-MON-YYYY') ------------------------------------------------------------------------------------------------------------ KAYITDATE ABONE ------------------------------------- ------------------- 10-JUN-09 09.52.57.796000000 AM 1 10-JUN-09 02.13.32.343000000 PM 1 2 rows selected
How can I do? If someone helped me on this subject, I would really appreciate it...BAGLANTITARIH ABONE ------------------------ ---------------- 10-JUN-09 03.01.52.546000000 AM 1 10-JUN-09 05.02.06.453000000 PM 1 10-JUN-09 01.01.20.421000000 PM 1 10-JUN-09 07.01.42.062000000 AM 1 10-JUN-09 09.44.59.515000000 AM 1 10-JUN-09 09.58.07.843000000 AM 1 10-JUN-09 09.01.50.546000000 PM 1 10-JUN-09 09.52.57.796000000 AM 1 10-JUN-09 02.13.32.343000000 PM 1 9 rows
Kind regards
SedefSELECT BAGLANTIDATE BAGLANTIDATE, CABONE CABONE FROM SEDEF_BILGI WHERE CABONE = '1' AND BAGLANTIDATE BETWEEN TO_DATE('10-JUN-2009','DD,MON-YYYY') AND TO_DATE('11-JUN-2009','DD-MON-YYYY') union all SELECT KAYITDATE, ABONE FROM GPRS_TB_SAYACISEMRI WHERE ABONE = '1' AND KAYITDATE BETWEEN TO_DATE('10-JUN-2009','DD,MON-YYYY') AND TO_DATE('11-JUN-2009','DD-MON-YYYY')
Ravi Kumar
-
Is it possible to join/merge two conference calls in MCU for one call in the same MCU
Situation - endpoint is part of two meetings of MCU (with one call on hold). I want to merge these two meetings to the MCU. Is there a way. MCU is 45xx series and this is a deployment of VCS - MCU. Thanks in advance.
No way to merge that I know, I've had similar scenarios and there is no automatic way to do it, the Conference, the participants will have to unplug one and join the other. Multiway will not work because that is intended to the unique endpoints being transmitted to a MCU, no MCU is not lift themselves.
-
Hello
How join/merge 2 different videos that are on the same video track? I am applying the correction of color and light 2 clips that are related to a transition. When I select the two clips at the same time, PE will not open the effect (for example, color, light) and it will give me a message "multiple clips selected, please select only a single clip."
I can right click and group 2 all clips, but still cannot access any adjustments. Is there a way to merge/video join multiple clips on the same track so that adjustments can be made? Thank you, Avo
AVO
What version of Premiere Elements and on what operating system works - it?
If the program won't let you adjust more than one clip at a time, and you want the same effect to multiple clips, then please consider...
Apply the effect to the first clip. Then right-click right the clip, select copy. Select (all at the same time) the remaining clips you want to have the same effect.
Right click anywhere in the selection and the effects of block selection and adjustments.
First items 11, 12 and 13 should use the above names for orders. Earlier versions may use slightly different names for them.
Please let us know if it works for you.
Various
1. I imagine you can export items to a file and then re-import the file in the project of changes to the video instead of different components that went into the video export.
2. to select items at a time
a. hold down the SHIFT key and click the file you want is selected
b. If any, Menu editing/select all
Thank you.
RTA
-
Hello
I have an obligation to update a field in a table with a value in another table without any common field, there is only 1 field that is common, but is not unique, so join on it will produce a Cartesian join. I tried to create a number line in tables and join based on it, but without success.
Can someone please help?
Thank you
merge into the target actual_acq_table
using the source (
) on (target.acq_code = source.acq_code
and target.acq_id = source.acq_id)
when matched, then update game
targets. ??? = source.acq_match_id;
-
Hi all!
I need help.
I have this function that launches a Select statement. My Oracle Grid tells me, when I adjust the selection of this function, it is a Cartesian product. I understand what is a Cartesian product, but I can't seem to find it. Can you help me by pointing out WHERE is the misteke? Thank you!!
PS EA Oracle 10.2.0.4 on windows Server 2003 R2 SP2 64-bit
[code]
create or replace
FUNCTION "ANA_GETVERBALE".
(
v_VerbaleId in NUMBERS by DEFAULT NULL,
v_Sezione IN VARCHAR2 DEFAULT NULL,
v_NumeroVerbale IN VARCHAR2 DEFAULT NULL,
v_DataVerbale DATE by DEFAULT NULL,
v_TargaVeicolo IN VARCHAR2 DEFAULT NULL,
v_Serie IN VARCHAR2 DEFAULT NULL,
v_LoggedUser IN VARCHAR2 DEFAULT NULL
)
RETURN SYS_REFCURSOR
AS
cv_1 SYS_REFCURSOR;
BEGIN
OPEN FOR Cv_1
SELECT
ANA_M.VerbaleId,
ANA_M.Sezione,
ANA_M.NumeroVerbale,
ANA_M.DataVerbale,
ANA_M.TargaVeicolo,
ANA_M.serie,
SCH_C.StatoCartellinoId,
LOV_StatoCartellino.ListOfValueName StatoCartellino,
sch_c.cartellinoid
OF ANA_Materia_Verbale ANA_M
INNER JOIN SCH_Cartellini SCH_C on SCH_C.SoggettoId is ana_m.verbaleid AND SCH_C.TipoSoggettoId = SIS_CONSTANTS_PKG. VB
INNER JOIN SIC_PROFILO_STATO SIC_PSC ON SIC_PSC. STATOID = SCH_C.STATOCARTELLINOID
INNER JOIN SIC_PROFILI_USERS SIC_PUC ON SIC_PUC. PROFILOID = SIC_PSC. PROFILOID AND SIC_PUC. PERSONALID = v_LoggedUser
LEFT JOIN TYP_ListOfValues LOV_StatoCartellino ON LOV_StatoCartellino.ListOfValueId = SCH_C.StatoCartellinoId
WHERE (v_VerbaleId = SIS_CONSTANTS_PKG. AnyBigint or ANA_M.VerbaleId = v_VerbaleId)
AND (v_Sezione = SIS_CONSTANTS_PKG. AnyString or REGEXP_LIKE(ANA_M.Sezione, '^' || v_Sezione ||) '$', 'i') )
AND (v_serie = SIS_CONSTANTS_PKG. AnyString or REGEXP_LIKE(ANA_M.Serie, '^' || v_Serie ||) '$', 'i') )
AND (v_NumeroVerbale = SIS_CONSTANTS_PKG. AnyString or ANA_M.NumeroVerbale = v_NumeroVerbale)
AND (v_DataVerbale = SIS_CONSTANTS_PKG. AnyDateTime or ANA_M.DataVerbale = v_DataVerbale)
AND (v_TargaVeicolo = SIS_CONSTANTS_PKG. AnyString or REGEXP_LIKE(ANA_M.TargaVeicolo,'^' || v_TargaVeicolo ||) '$', 'i') );
RETURN cv_1;
END;
[/ code]
While it's complained the Cartesian product?
Or is it just the fact that you've seen "MERGE JOIN CARTESIAN" in your plan to explain?
If so, read this...
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:4105951726381
Maybe you are looking for
-
Tecra A10 won't boot windows 7
Dear forumI used Easeus todo backup to backup my OS.Later I stupidly formatted the hard drive probably clear in the important boot partition/sector that may have existed. After that I "restored" the windows image file on my laptop 7 Unfortunately, it
-
Card reader SD of Tecra M1 wont work
Hello When I insert an SD card into my DD drive on the side of my laptop tecra M1, the light will not come on the laptop won't recognize it.Please respond with a solution. Thank you
-
HP 15.6 laptop "touch screen: laptop stuck in the loop of continuous factory reset
I brought a laptop that has been the view at Sam model yesterday. I tried to do a factory reset, but once he gets to "Windows Setup" it makes a continuous loop. It will start at 64% go to 100%, then restart. When it turns on, it is always 'Windows
-
My mouse (USB and mousepad on laptop) has been freezing. I tried to turn on the traces of the mouse and it is completely frozen. The only way to fix is to turn off my computer and power. Help! Any ideas?
-
I'm trying to activate my window Vista Home Basic but fails.
Sir, I try to activate my window Vista Home Basic but fails. in front of many, I managed to activate, but now after re installing my window I do not activate online. Sir, I try to activate my window Vista Home Basic but fails. in front of many, I man