Performance considerations between a cross join and inner join

Hi there,
What's the performance difference and impact on running a cross-join based query against an inner join based query?
Regards and thanks

Before going to the performance issue - ensure you get the required data and not just some data shown.
Performance should be checked only between equivalent queries which produce same output but with different processing.
Are you sure you get same output in cross join as well as inner join?
If so pass on your different queries and then discuss with one is better.

Similar Messages

  • Oute Join and Inner Join

    Hi,
    I need to join three tables, based on some conditions (EKPO, EKBE and EKKN Note: All PO line items from EKPO will have a movement associated in the EKBE Table. Capture all PO line items where no matches found in the EKPO-EKBE join)
    for the above requirement shall I write my query like this?
    SELECT ekpo~ebeln
             ekpo~ebelp
             ekpo~loekz
             ekpo~txz01
             ekpo~matnr
             ekpo~bukrs
             ekpo~werks
             ekpo~menge
             ekpo~meins
             ekpo~knttp
             ekbe~vgabe
             ekbe~bwart
             ekbe~menge
             ekbe~dmbtr
             ekbe~shkzg
             ekkn~sakto
             ekkn~kostl
             ekkn~ps_psp_pnr
    INTO CORRESPONDING FIELDS OF TABLE i_podata
             FROM ekpo LEFT OUTER JOIN ekbe ON ekbeebeln = ekpoebeln AND
                                               ekbeebelp = ekpoebelp
                            INNER JOIN ekkn ON ekknebeln = ekpoebeln AND
                                               ekknebelp = ekpoebelp
                                         WHERE ekpo~werks IN s_werks AND
                                               ekpo~ebeln IN s_ebeln.
    Shall I use both Outer Join and Inner join in one Query?
    Please correcte me.
    Thanks
    Frank Rex

    Hi,
    You can use both inner join and outer join in the same select statement.
    Ensure first all the inner joins between tables are declared and put the left outer join at the end.
    Some sample code for your reference:
      SELECT
              AVBELN AKUNNR ABSTNK ABSTDK AVKORG AVTWEG AAUART AKNUMV
              BPOSNR BMATNR BWERKS BSPART BLGORT BKZWI1
              SUM( BKWMENG ) AS KWMENG DBZIRK D~VKGRP
              EDISPO EPRCTR
    FROM VBAK AS A INNER JOIN VBAP AS B ON AVBELN EQ BVBELN
                   INNER JOIN VBPA AS C ON CVBELN EQ BVBELN
                   INNER JOIN KNVV AS D ON DKUNNR EQ AKUNNR
                AND DVKORG EQ AVKORG AND DVTWEG EQ AVTWEG
                   LEFT OUTER JOIN MARC AS E ON E~MATNR EQ
                             BMATNR AND EWERKS EQ B~WERKS
              INTO CORRESPONDING FIELDS OF TABLE IT_ORDERS
              WHERE A~VKORG IN SO_VKORG
              AND A~VTWEG IN SO_VTWEG
              AND A~KUNNR IN SO_KUNNR
              AND A~ERDAT IN SO_ERDAT
              AND A~AUART IN ('ZFOR','ZROR','ZEOR','ZDXR','ZXOR','ZRM1','ZGOR','ZSOR')
              AND B~MATNR IN SO_MATNR
              AND B~WERKS IN SO_WERKS
              AND B~SPART IN SO_SPART
              AND B~ABGRU EQ SPACE
              AND A~LIFSK EQ SPACE
              AND A~FAKSK EQ SPACE
              AND B~VSTEL IN SO_VSTEL
              AND B~LGORT IN SO_LGORT
              AND C~KUNNR IN SO_SHIP
              AND C~PARVW EQ 'WE'
              AND D~VKGRP IN SO_VKGRP
              AND D~BZIRK IN SO_BZIRK
              AND B~LGORT NE '0950'
              GROUP BY AVBELN AKUNNR ABSTNK ABSTDK 
              AVKORG AVTWEG AAUART AKNUMV B~POSNR
              BMATNR BWERKS BSPART BKZWI1 D~BZIRK
              DVKGRP BLGORT EDISPO EPRCTR E~MATGR.
    Lakshminarayanan.
    P.S.Mark all helpful answers for points.

  • Difference between inner join and outer join

    1.Difference between inner join and outer join
    2.wht is the difference in using hide and get crusor value in interactive.
    3. Using join is better or views in writting program . Which is better.

    Table 1                      Table 2
    A
    B
    C
    D
    D
    E
    F
    G
    H
    a1
    b1
    c1
    1
    1
    e1
    f1
    g1
    h1
    a2
    b2
    c2
    1
    3
    e2
    f2
    g2
    h2
    a3
    b3
    c3
    2
    4
    e3
    f3
    g3
    h3
    a4
    b4
    c4
    3
    |--|||--|
        Inner Join
        |--||||||||--|
        | A  | B  | C  | D  | D  | E  | F  | G  | H  |
        |--||||||||--|
        | a1 | b1 | c1 | 1  | 1  | e1 | f1 | g1 | h1 |
        | a2 | b2 | c2 | 1  | 1  | e1 | f1 | g1 | h1 |
        | a4 | b4 | c4 | 3  | 3  | e2 | f2 | g2 | h2 |
        |--||||||||--|
    Example
    Output a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
    DATA: DATE   LIKE SFLIGHT-FLDATE,
          CARRID LIKE SFLIGHT-CARRID,
          CONNID LIKE SFLIGHT-CONNID.
    SELECT FCARRID FCONNID F~FLDATE
        INTO (CARRID, CONNID, DATE)
        FROM SFLIGHT AS F INNER JOIN SPFLI AS P
               ON FCARRID = PCARRID AND
                  FCONNID = PCONNID
        WHERE P~CITYFROM = 'FRANKFURT'
          AND P~CITYTO   = 'NEW YORK'
          AND F~FLDATE BETWEEN '20010910' AND '20010920'
          AND FSEATSOCC < FSEATSMAX.
      WRITE: / DATE, CARRID, CONNID.
    ENDSELECT.
    If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or a table alias.
    Note
    In order to determine the result of a SELECT command where the FROM clause contains a join, the database system first creates a temporary table containing the lines that meet the ON condition. The WHERE condition is then applied to the temporary table. It does not matter in an inner join whether the condition is in the ON or WHEREclause. The following example returns the same solution as the previous one.
    Example
    Output of a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
    DATA: DATE   LIKE SFLIGHT-FLDATE,
          CARRID LIKE SFLIGHT-CARRID,
          CONNID LIKE SFLIGHT-CONNID.
    SELECT FCARRID FCONNID F~FLDATE
        INTO (CARRID, CONNID, DATE)
        FROM SFLIGHT AS F INNER JOIN SPFLI AS P
               ON FCARRID = PCARRID
        WHERE FCONNID = PCONNID
          AND P~CITYFROM = 'FRANKFURT'
          AND P~CITYTO   = 'NEW YORK'
          AND F~FLDATE BETWEEN '20010910' AND '20010920'
          AND FSEATSOCC < FSEATSMAX.
      WRITE: / DATE, CARRID, CONNID.
    ENDSELECT.
    Note
    Since not all of the database systems supported by SAP use the standard syntax for ON conditions, the syntax has been restricted. It only allows those joins that produce the same results on all of the supported database systems:
    Only a table or view may appear to the right of the JOIN operator, not another join expression.
    Only AND is possible in the ON condition as a logical operator.
    Each comparison in the ON condition must contain a field from the right-hand table.
    If an outer join occurs in the FROM clause, all the ON conditions must contain at least one "real" JOIN condition (a condition that contains a field from tabref1 amd a field from tabref2.
    Note
    In some cases, '*' may be specified in the SELECT clause, and an internal table or work area is entered into the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the FROM clause, according to the structure of each table work area. There can then be gaps between table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, not simply by counting the total number of fields. For an example, see below:
    Variant 3
    ... FROM tabref1 LEFT [OUTER] JOIN tabref2 ON cond
    Effect
    Selects the data from the transparent database tables and/or views specified in tabref1 and tabref2. tabref1 und tabref2 both have either the same form as in variant 1 or are themselves join expressions. The keyword OUTER can be omitted. The database tables or views specified in tabref1 and tabref2 must be recognized by the ABAP-Dictionary.
    In order to determine the result of a SELECT command where the FROM clause contains a left outer join, the database system creates a temporary table containing the lines that meet the ON condition. The remaining fields from the left-hand table (tabref1) are then added to this table, and their corresponding fields from the right-hand table are filled with ZERO values. The system then applies the WHERE condition to the table.
    Left outer join between table 1 and table 2 where column D in both tables set the join condition:
    Table 1                      Table 2
    A
    B
    C
    D
    D
    E
    F
    G
    H
    a1
    b1
    c1
    1
    1
    e1
    f1
    g1
    h1
    a2
    b2
    c2
    1
    3
    e2
    f2
    g2
    h2
    a3
    b3
    c3
    2
    4
    e3
    f3
    g3
    h3
    a4
    b4
    c4
    3
    |--|||--|
        Left Outer Join
        |--||||||||--|
        | A  | B  | C  | D  | D  | E  | F  | G  | H  |
        |--||||||||--|
        | a1 | b1 | c1 | 1  | 1  | e1 | f1 | g1 | h1 |
        | a2 | b2 | c2 | 1  | 1  | e1 | f1 | g1 | h1 |
        | a3 | b3 | c3 | 2  |NULL|NULL|NULL|NULL|NULL|
        | a4 | b4 | c4 | 3  | 3  | e2 | f2 | g2 | h2 |
        |--||||||||--|
    Regards
    Prabhu

  • Difference between physical join and logical join

    Hi Gurus,
    Can anyone tell me what is the difference between physical join and logical join
    Thanks,
    Chandra

    Hi,
    A physical join is at the physical layer and defines the join between two physical tables. Logical joins live at the BMM (logical) layer and define a join between two logical tables.
    The important differentiation is that at the BMM layer you do not tell the OBIEE server how to do the join, you just tell it that there is a relationship between these two logical entities. When the server comes to this logical join it will use the information in the physical joins and decides how the two logical tables are joined together.
    In BMM you use complex joins to establish which logical tables are joined which another, the OBI EE server will go to the physical level to search the physical join to make the query. You can also use physical joins in the BMM to override the join in the physical layer but only in very specific conditions.
    If you also set complex join in the physical layer OBI EE won't be able to construct the physical query.
    Hope this answers your question.
    Award points if helpful.
    Thanks,
    -Amith.

  • Inner join and outer join

    hi friends,
    how to use inner join and outer join methods in abap. pls explain

    you have to code them
    Seriously, I suggest you take an ABAP class, it's out of the scope of this forum to tech you how to program joins.
    Markus

  • Nested loop, merge join and harsh join

    Can any one tell me the difference/relationship between nested loop, harsh join and merge join...Thanx

    Check Oracle Performance Tuning Guide
    13.6 Understanding Joins
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#i51523

  • Equal Join and Outer Join in OBIEE

    Hello expert,
    I think the default join in OBIEE is Outer Join. So no matter what join conditions that I specify on the physical layer, the result that I get in the presentation layer is still outer join.
    How to specify the equal join or inner join in Business and Logical layer?

    Hello,
    Thank you for your reply. However it does not work. I got the following message:
    [nQSError: 32005] The object "Fact - Fruit" bc if type 'LOGICAL TABLE SOURCE': is missing a foreign key or a complex join in the join graph.
    The situation that I have is:
    Fact table: "Fact - Fruit"
    List of value table (look up table): "dim_list_of_values"
    I am only interested in the type in the "dim_list_of_values" table where equals to "Apple". So I only want to join the "Fact - Fruit" and "dim_list_of_values" with those records with "Apple" type.
    It sounds to me that I am unable to define a freign key.

  • Diff bw complex join and physical join

    hi all
    Can sumbody explain me the all the differences between complex join and physical join in the admin tool
    Thanks
    Shobhit

    Hi,
    Suggest you to go through this link. It may be helpful in detail.
    http://st-urriculum.oracle.com/obe/fmw/bi/biee/r1013/bi_admin/biadmin.html
    Thanks,
    Vengatesh.

  • Both equii join and natural join are equall.will both display same   output

    both equii join and natural join are equall.will both display same
    output?

    Hi ,
    What is preventing you to do a small test and check yourself?
    See the below link.
    http://psoug.org/reference/joins.html
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> CREATE TABLE parents (
      2  person_id  NUMBER(5),
      3  adult_name VARCHAR2(20),
      4  comments   VARCHAR2(40))
      5  PCTFREE 0;
    Table created.
    SQL>
    SQL> CREATE TABLE children (
      2  parent_id    NUMBER(5),
      3  person_id    NUMBER(5),
      4  child_name   VARCHAR2(20),
      5  comments     VARCHAR2(40))
      6  PCTFREE 0;
    Table created.
    SQL>
    SQL> INSERT INTO parents VALUES (1, 'Dan', 'So What');
    1 row created.
    SQL> INSERT INTO parents VALUES (2, 'Jack', 'Who Cares');
    1 row created.
    SQL> INSERT INTO children VALUES (1, 2, 'Anne', 'Who Cares');
    1 row created.
    SQL> INSERT INTO children VALUES (1, 1, 'Julia', 'Yeah Right');
    1 row created.
    SQL> INSERT INTO children VALUES (2, 1, 'Marcella', 'So What');
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL>
    SQL> SELECT adult_name, child_name
      2  FROM parents NATURAL JOIN children;
    ADULT_NAME           CHILD_NAME
    Jack                 Anne
    Dan                  Marcella
    SQL> select adult_name,child_name from parents a, children b
      2  where a.person_id=b.person_id;
    ADULT_NAME           CHILD_NAME
    Jack                 Anne
    Dan                  Julia
    Dan                  Marcella
    SQL> ed
    Wrote file afiedt.buf
      1  select adult_name,child_name from parents a, children b
      2* where a.person_id=b.parent_id
    SQL> /
    ADULT_NAME           CHILD_NAME
    Dan                  Anne
    Dan                  Julia
    Jack                 Marcella
    SQL>Regards,
    Avinash

  • Diff between database view and inner join

    Hello,
    I need to select data from multiple tables. I need to choose between 2 options.
    1) create a database view and use this view for select.
    2) write an inner join in abap prorgam.
    In which cases we should create a view and in which cases we should use a inner join?
    What are the factors which decide these?
    Pls advice.
    Thanks,
    Rupali.

    Hi,
    Both are same..
    But if you use regulary and used view in Multiple programs then create view..
    If inner join in abap prorgam between two or more table used in less Programs and do not want to
    create View (Means not to create transport request) then go for JOin in Program.
    Prabhudas

  • Link for BUT000 table and ADRC in CRM and inner join is not working in PCUI

    Hi Gurus,
       Please tell me the link btween BUT000 and ADRC table. and i wrote one inner join between BUT000 and BUT0id table but it not working. I m in CRM 4.0 version working with PCUI.
    select but000partner but000name_org1 but000name_org2 but000bus_sort1 but0id~parnter1
          but0ididnumber from but000 inner join but0id on but0idpartner = but000~parnter
    into corresponding fields of table it_result where partner in s_partner.
    It is giving error as partner unknown from but000 table. I delcared everything and tried with alias names also.
    please clarify me.
    regards,
    Ramakrishna.

    Hi Frederic,
       thanks a lot. But is inner join between BUT000 and BUT0ID will work. for me it is not working. plesae see this code.
    tables : but000,
             but0id,
             crmm_but_custno,
             adrc.
    types : begin of typ_but000,
            partner type bu_partner,
            name_org1 type BU_NAMEOR1,
            name_org2 type BU_NAMEOR2,
            bu_sort1  type BU_SORT1,
            idnumber type BU_ID_NUMBER,
            partner1 type bu_partner,
            end of typ_but000.
    data: lt_but000 type table of typ_but000,
          ls_but000 like line of lt_but000.
    *select-options : s_partnr for but000-partner.
    start-of-selection.
          select but000partner but000name_org1 but000name_org2 but000bu_sort1 but0id~parnter1
                    but0id~idnumber into corresponding fields of table lt_but000 from  but000
                    inner join but0id on but0idpartner = but000parnter. " where partner in s_partner.
    it is giving error as but000-partner is not know or but0id-partner not known.
    So, i think if it not works then i should write two select stmts.
    please clarify me.
    i gave u rating.
    thanks
    ramakrishna.

  • What is the different between Logical complex join and Physical join?

    hi,
    Do somebody know what is the function different between logical complex join in BMM layer and physical join in physical layer?
    Thanks.

    Thank you very much1
    I understand their differentiation:
    In the BMM Complex join (intelligent), means OBI picks the best way from possibly many different ways to join using physical join. FK join forces the same join always, which limits flexibility.

  • SOLVED!!!Cross DB Link INNER JOIN resultingin 0 rows returned????

    Has anyone had experience with a JOIN not returning the result that the data shows it should?
    I am writing a query to join two tables across DBs and I know that most of the IDs in the joining columns do in fact match, but when I INNER JOIN, no rows are returned. As you would expect, a LEFT OUTER JOIN RESULTS in my right table showing and a full set of null values for each of the columns of the newly joined table.
    Has anyone come across this behavior?
    I can even do a select on the table to be joined and use the where clause to show that some of the values from the first table do in fact existed within the table to be joined.
    I'm frustrated and a little confused.
    Can anyone help?
    Message was edited by:
    DPotter

    Are the columns on which you are joining are of DATE datatype? If yes then without TRUNC you will be in trouble.
    If it is not the case give column datatypes and sample data.
    See the simple example below:
    SQL> SELECT 1 VAL
    FROM DUAL
    WHERE SYSDATE = TO_DATE('08-MAY-2008','DD-MON-YYYY') ;  2    3 
    no rows selected
    SQL> SELECT SYSDATE
    FROM DUAL;  2 
    SYSDATE
    08-MAY-08
    SQL>
    SELECT 1 VAL
    FROM DUAL
    WHERE TRUNC(SYSDATE) = TO_DATE('08-MAY-2008','DD-MON-YYYY') ;SQL>   2    3 
           VAL
             1

  • Performance Difference Between Dual 2.7 and Quad, and Logic Pro

    I used to have a G5 DP 2.7 before it went bad and Apple offered me a Quad in exchange. I'd like to understand some details of the specs between these two computers and how they might translate with respect to running Logic Pro (which I'll get to in a minute)...
    Listed below are the specs which I believe illustrate the significant differences between these two machines (this info is based on info gleaned from Macworld, since the specific specs of the DP 2.7 no longer appear on Apple's website):
    Dual 2.7
    (2x) 2.7 GHz, cache = 512K per processor, frontside bus speed = 1.35 GHz per processor
    Quad
    (4x) 2.5 GHz, cache = 2MB on-chip L2 per chip, frontside bus speed = 1.25 GHz per processor
    So here's the link with Logic: it's become apparent of late that Logic Pro is not able to fully utilize the processing power of all 4 cores in the Quad. Reports are that performance tops out at 50% per processor, resulting in approx. 200% possible processing usage from the 4 cores in the Quad.
    However, such a limitation in processor usage wasn't present in the DP 2.7.
    So based on the information I've learned so far, it seems that the Quad and the DP 2.7 are almost equivalent in terms of processing power when running Logic Pro. Now, this is what I'm surmising, but, is this actually the case? At the end of the day, I'd like to know if the Quad indeed a more powerful computer than the DP 2.7 when running Logic Pro, or, did my exchange of DP 2.7 for the Quad constitute a "downgrade" of any proportion?

    The only logical answer to Why Intels do and PPC don't is:
    Apple want everybody to transition to their Intel boxes. The only way to do this is offer better performance in software tweaks for one system over the another, which begs the question what else will Apple do to software for PPC owners?
    Having bought a Mac Pro, primerily for testing out certain software apz under Rosetta, I did a real time test between my 8GB RAM G5 Quad and my stock Mac Pro upgraded to 2GB RAM, batch processing 204 Canon 1DsMKII RAW files into 16-Bitt TIFFs. I put a thread on the Mac Pro forum here:
    http://discussions.apple.com/thread.jspa?threadID=627916&tstart=15
    I so wanted my Quad to squash the Intel invaded Mac, but results speak for themselves. The Mac Pro flattened the G5 Quad by over 23 minutes (it worked out as 1.7 times faster than the G5Quad).
    If that's how it performs with 2GB RAM it's gonna really fly when I max it out. So, for musicians, I would imagine with the Quad core support for Intel Macs in Logic 7.2.2 makes a fairly straight forward decision. . .buy a Mac Pro and sell your PowerMac. More time composing less time waiting for renders (never used music software so if it doesn't render your composition place whatever it does do into the 'renders' slot )
    P.S I hated, really hated having to say the Mac Pro toasted my G5 Quad, I so wanted the Intel to fall flat on it's aluminium as$, but it didn't. It's a quick machine. A very quick machine which toasted my Quad in real time tests using a universal Pro app from a 3rd Party (who would have no incentive to dumb down the PPC version as they sell their product to Windows, PPC OS X and Intel OS X)

  • Is there a performance difference between Automation Plug-ins and the scripting system?

    We currently have a tool that, through the scripting system, merges and hides layers by layer groups, exports them, and then moves to the next layer group.  There is some custom logic and channel merging that occasionally occurs in the merging of an individual layer group.  These operations are occuring through the scripting system (actually, through C# making direct function calls through Photoshop), and there are some images where these operations take ~30-40 minutes to complete on very large images.
    Is there a performance difference between doing the actions in this way as opposed to having these actions occur in an automation plug-in?
    Thanks,

    Thanks for the reply.    I ended up just benchmarking the current implementation that we are using (which goes through DOM from all indications, I wasn't the original author of the code) and found that accessing each layer was taking upwards of 300 ms.  I benchmarked iterating through the layers with PIUGetInfoByIndexIndex (in the Getter automation plug-in) and found that the first layer took ~300 ms, but the rest took ~1 ms.  With that information, I decided that it was worthwhile rewriting the functionality in an Automation plug-in.

Maybe you are looking for

  • Time out parameters for java servers

    Dear Gurus, I'm trying to identify if there are any time out parameters/attributes which can be set for the users at Java level. I'm wondering if it's possible to limit a user from running a report/query for a long period of time. Or a parameter to l

  • Cc trial expired now can't open cs6 files

    I downloaded indesign cc to use while I was waiting for my cs6 to arrive. Now the files I save from cs6 will not open. I get a message that says my trial has expired, and the icons look like a blank white page. However, I can open the saved files fro

  • How to see PR created by MRP

    hi i run MRP by md02 how to see that how many PR has been created and how many production order created i try to use ME5A nothing is displayed please explain thanks ganesh

  • Install Error: [0008] loading Free MAQ software Irish & Portuguese dialogs

    As it says - every time I try to install or re-install, the process gets to 50% and then abends with the 0008 message I'm on a 32Gb Playbook, running 2.0.1.358

  • API_METHOD

    Hi I need to know an API which will return me all the names of BAPIS as well as ZBAPI's. Currently I am using the method <b>SWO_QUERY_API_METHODS</b> to get me the list of BAPI's. But this does NOT seem to give the ZBAPI's in the list. Is there anoth