Do Outer Joins as well as Self Joins Affect the Performence of a Query ??

4 Tables A,B,C,D.
1 View V Based
Each of the tables having 1 and only one primary key and a few NOT NULL columns.
Now my Query selects from A,B,C,D,V with mapping Table A columns with all other Table(B,C,D,V) Primary Key Columns using Left Outer Join.
Select A.a1,A.a2,A.a3,A.a4,B1.ba,B2.bb,B3.bc,B4.bd,C.c1,D.d1 from (((((((A left outer join B B1 on A.ba=B1.ba) left outer join B B2 on A.bb=B2.bb) left outer join B B3 on A.bc=B3.bc)left outer join B B4 on A.bd=B4.bd)left outer join C on A.c1=C.c1)left outer join D on A.d1=D.d1) left outer join V on A.v1 = V.v1) order by 1;
In this case will the query design effect the Performence???... As this query is taking a long time. As for as Indexes are there on these tables only default Indexes due to Primary, Unique as well as Foreign key only.... Hence table structure is very simple and straight. I need a suggession in such a manner that without making changes to the Table (I am not even allowed to include a single Index to them) ...can the query be modified to optimise the performence??

Each change to a query can effect the performance.
Your query looks straight and simple. Maybe you could increase the performance by simply removeing the order by criteria.
This requires a sort and a sort can be slow, especially when the resulting dataset is very large.
If there are indexes on all foreign keys and you join using those FKs then there should be no problem with the index structure.
I can't say whether it would be better to use an index or not. but you can look at the execution plan and check what the CBO wants to do.
Make sure that all statistics are up to date. You could consider to run an additional dbms_stats.gather_table_stats with compute in the test environment, just to see if the execution plan changes after this.
For further ideas search this forum for the thread "When your query takes too long".

Similar Messages

  • Pushing out a billing date through a project - affect the pricing in a SO

    Hello
    I have two sales orders for a customer with same terms of payment, pricing procedure and everything almost similar except dates (say billing dates). the company is mainly using project systems. they are using billing plans. even the billing plans, billing types are also same.
    The Issue is that, for one sales order it picking the Gross Value (present in document header -> Condition tab) as Net Value for the sales order. However for the another sales order it is picking the Total (present in document header -> Condition tab) as Net Value for the sales order.
    Can anyone please explain me why the system is behaving like that, what is the mistake I did. I want the system to pick total value.
    "pushing out a billing date through a project would affect the pricing in a sales order. the netted discount is not showing any more." - this is the issue
    Thank You,
    Gokul

    I have Flip for Mac...
    But do you have the paid for version or the free one?
    The free version only lets you export half of the video up to a maximum of thirty seconds.

  • Oracle query with out using self join

    hi friends,
    i have one table for exeample PERSTATUS
    pk/fK STUDENT NUMBER SUBJECT MARKS STATUS
    1 ACCOUNTS 15 RED
    1 MATHS 35 YELLOW
    1 SCINECE 45 GREEN
    2 ACCOUNTS 55 BROWN
    2 MATHS 35 YELLOW
    2 SCINECE 45 GREEN
    3 ACCOUNTS 15 RED
    3 MATHS 35 YELLOW
    3 SCINECE 45 GREEN
    i want students how status is both red and yellow so i am using self join
    i want students status is both red and yellow so i am using self join
    SELECT PS.STUDENTNUMBER,PS.STATUS,PS.STATUS1 FROM PERSTATUS PS ,PERSTATUS PS1
    WHERE PS.STUDENTNUMBER-PS1.STUDENTNUMER
    PS.STATUS='RED' AND PS1.STAUTS='YELLOW'
    i want students status is both RD and YELLOW AND GREEN so i am using self join( two self joinS}
    SELECT PS.STUDENTNUMBER,PS.STATUS,PS.STATUS,PS2.STATUS FROM PERSTATUS PS ,PERSTATUS PS1,PERSTATUS PS2
    WHERE PS.STUDENTNUMBER-PS1.STUDENTNUMER AND PS.STUDENTNUMBER-PS2.STUDENTNUMBER
    PS.STATUS='RED' AND PS1.STAUTS='YELLOW' AND PS2.STAUTUS='GREEN'
    if i require MORE STATUS then more self joins required, is there any alternative to achive this
    and if results comes in multiple rows are accepted (since with the above query result will come in single row)
    i tried to use group by (studentnumber,status) with status='red' and status='yellow'
    but it is not possible could you povidet he solution

    Hi,
    Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data, and the exact results you want from that data. Explain how you get those results from that data.
    See the forum FAQ {message:id=9360002}
    Here's an example of how to post the sample data:
    CREATE TABLE     perstatus
    (       studentnumber     NUMBER
    ,     subject          VARCHAR2 (10)
    ,     marks          NUMBER
    ,     status          VARCHAR2 (10)
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (1,           'ACCOUNTS', 15,       'RED');
    INSERT INTO perstatus (studentnumber, subject  ,  marks, status)
           VALUES           (1,           'MATHS',        35,       'YELLOW');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (1,           'SCINECE',  45,       'GREEN');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (2,           'ACCOUNTS', 55,       'BROWN');
    INSERT INTO perstatus (studentnumber, subject  ,  marks, status)
           VALUES           (2,           'MATHS',        35,       'YELLOW');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (2,           'SCINECE',  45,       'GREEN');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (3,           'ACCOUNTS', 15,       'RED');
    INSERT INTO perstatus (studentnumber, subject  ,  marks, status)
           VALUES           (3,           'MATHS',        35,       'YELLOW');
    INSERT INTO perstatus (studentnumber, subject,    marks, status)
           VALUES           (3,           'SCINECE',  45,       'GREEN');You were on the right track, thinking about GROUP BY. You're interested in something about the whole group of rows that has the same studentnumber. Looking at any individual row won't tell you if that row is part of the group you're interested in or not.
    If you want to see information about the group as a whole, you can do the whole job with GROUP BY. In this case, studnetnumber is the only thing that an entire group has in common. If you wanted to see the studentnumbers that had both RED and YELLOW, that is:
    STUDENTNUMBER
                1
                3here's one way you could do it:
    SELECT       studentnumber
    FROM       perstatus
    WHERE       status     IN ('RED', 'YELLOW')
    GROUP BY  studentnumber
    HAVING       COUNT (DISTINCT status) = 2  -- That is, both RED and YELLOW
    ORDER BY  studentnumber
    ;But say you wanted to see details about individuals in the group; for example, say we want to see all the columns for students that have all 3 of RED, YELLOW and GREEN, like this:
    STUDENTNUMBER SUBJECT         MARKS STATUS
                1 SCINECE            45 GREEN
                1 ACCOUNTS           15 RED
                1 MATHS              35 YELLOW
                3 SCINECE            45 GREEN
                3 ACCOUNTS           15 RED
                3 MATHS              35 YELLOWWe used the aggregate COUNT function earlier, but aggregate functions require collapsing the results down to one row per group.
    However, most of the aggregate functions, like COUNT, have analytic counterparts, that can give the same results without collapsing the result set. Here's one way to get the results above, using the analytic COUNT function:
    WITH     got_cnt          AS
         SELECT  studentnumber, subject, marks, status
         ,     COUNT ( DISTINCT CASE
                                   WHEN  status  IN ('RED', 'YELLOW', 'GREEN')
                             THEN  status
                               END
                    ) OVER (PARTITION BY  studentnumber)     AS cnt
         FROM    perstatus
    SELECT    studentnumber, subject, marks, status
    FROM       got_cnt
    WHERE       cnt  = 3
    ORDER BY  studentnumber
    ,            status
    ;

  • [8i] Need help with full outer join combined with a cross-join....

    I can't figure out how to combine a full outer join with another type of join ... is this possible?
    Here's some create table and insert statements for some basic sample data:
    CREATE TABLE     my_tab1
    (     record_id     NUMBER     NOT NULL     
    ,     workstation     VARCHAR2(4)
    ,     my_value     NUMBER
         CONSTRAINT my_tab1_pk PRIMARY KEY (record_id)
    INSERT INTO     my_tab1
    VALUES(1,'ABCD',10);
    INSERT INTO     my_tab1
    VALUES(2,'ABCD',15);
    INSERT INTO     my_tab1
    VALUES(3,'ABCD',5);
    INSERT INTO     my_tab1
    VALUES(4,'A123',5);
    INSERT INTO     my_tab1
    VALUES(5,'A123',10);
    INSERT INTO     my_tab1
    VALUES(6,'A123',20);
    INSERT INTO     my_tab1
    VALUES(7,'????',5);
    CREATE TABLE     my_tab2
    (     workstation     VARCHAR2(4)
    ,     wkstn_name     VARCHAR2(20)
         CONSTRAINT my_tab2_pk PRIMARY KEY (workstation)
    INSERT INTO     my_tab2
    VALUES('ABCD','WKSTN 1');
    INSERT INTO     my_tab2
    VALUES('A123','WKSTN 2');
    INSERT INTO     my_tab2
    VALUES('B456','WKSTN 3');
    CREATE TABLE     my_tab3
    (     my_nbr1     NUMBER
    ,     my_nbr2     NUMBER
    INSERT INTO     my_tab3
    VALUES(1,2);
    INSERT INTO     my_tab3
    VALUES(2,3);
    INSERT INTO     my_tab3
    VALUES(3,4);And, the results I want to get:
    workstation     sum(my_value)     wkstn_name     my_nbr1     my_nbr2
    ABCD          30          WKSTN 1          1     2
    ABCD          30          WKSTN 1          2     3
    ABCD          30          WKSTN 1          3     4
    A123          35          WKSTN 2          1     2
    A123          35          WKSTN 2          2     3
    A123          35          WKSTN 2          3     4
    B456          0          WKSTN 3          1     2
    B456          0          WKSTN 3          2     3
    B456          0          WKSTN 3          3     4
    ????          5          NULL          1     2
    ????          5          NULL          2     3
    ????          5          NULL          3     4I've tried a number of different things, googled my problem, and no luck yet...
    SELECT     t1.workstation
    ,     SUM(t1.my_value)
    ,     t2.wkstn_name
    ,     t3.my_nbr1
    ,     t3.my_nbr2
    FROM     my_tab1 t1
    ,     my_tab2 t2
    ,     my_tab3 t3
    ...So, what I want is a full outer join of t1 and t2 on workstation, and a cross-join of that with t3. I'm wondering if I can't find any examples of this online because it's not possible....
    Note: I'm stuck dealing with Oracle 8i
    Thanks!!

    Hi,
    The query I posted yesterday is a little more complicated than it needs to be.
    Since my_tab2.workstation is unique, there's no reason to do a separate sub-query like mt1; we can join my_tab1 to my_tab2 and get the SUM all in one sub-query.
    SELECT       foj.workstation
    ,       foj.sum_my_value
    ,       foj.wkstn_name
    ,       mt3.my_nbr1
    ,       mt3.my_nbr2
    FROM       (     -- Begin in-line view foj for full outer join
              SELECT        mt1.workstation
              ,        SUM (mt1.my_value)     AS sum_my_value
              ,        mt2.wkstn_name
              FROM        my_tab1   mt1
              ,        my_tab2   mt2
              WHERE        mt1.workstation     = mt2.workstation (+)
              GROUP BY   mt1.workstation
              ,        mt2.wkstn_name
                    UNION ALL
              SELECT      workstation
              ,      0      AS sum_my_value
              ,      wkstn_name
              FROM      my_tab2
              WHERE      workstation     NOT IN (     -- Begin NOT IN sub-query
                                               SELECT      workstation
                                       FROM      my_tab1
                                       WHERE      workstation     IS NOT NULL
                                     )     -- End NOT IN sub-query
           ) foj     -- End in-line view foj for full outer join
    ,       my_tab3  mt3
    ORDER BY  foj.wkstn_name
    ,       foj.workstation
    ,       mt3.my_nbr1
    ,       mt3.my_nbr2
    ;Thanks for posting the CREATE TABLE and INSERT statements, as well as the very clear desired results!
    user11033437 wrote:
    ... So, what I want is a full outer join of t1 and t2 on workstation, and a cross-join of that with t3. That it, exactly!
    The tricky part is how and when to get SUM (my_value). You might approach this by figuring out exactly what my_tab3 has to be cross-joined to; that is, exactly what should the result set of the full outer join between my_tab1 and my_tab2 look like. To do that, take your desired results, remove the columns that do not come from the full outer join, and remove the duplicate rows. You'll get:
    workstation     sum(my_value)     wkstn_name
    ABCD          30          WKSTN 1          
    A123          35          WKSTN 2          
    B456          0          WKSTN 3          
    ????          5          NULL          So the core of the problem is how to get these results from my_tab1 and my_tab2, which is done in sub-query foj above.
    I tried to use self-documenting names in my code. I hope you can understand it.
    I could spend hours explaining different parts of this query in more detail, but I'm sure I'd waste some of that time explaining things you already understand. If you want an explanation of somthing(s) specific, let me know.

  • SQL Query, group by or self join?

    Hi All,
    I have a table with about 100,000 rows.. It is a linking table. I want to filter out some of the data. At the bottom I will put a sample table. I am really after advice if I should be using the group by, or something else. It is really slow, and I really wanted to make a view from the query, but it won't run in realtime (I thought about Materialised views, but the data could change and I would want it updated)
    So the data would like like this.
    1 1
    A 1
    B 1
    1 A
    1 B
    2 null/0
    And I want to transform it into a result that looks like this.
    A 1
    B 1
    2 0
    (I can live with 1 1 as well)
    The first query I have come up with is
    select
    A.TXN, A.ID SCHED_INFO, A.STA ORIG_ACT
    from
    SELECT
    Txn, ID,
    STA
    FROM TEST_STA
    WHERE TXN < 0
    ) A,
    select ID, count(STA)
    FROM test_STA
    WHERE TXN < 0
    group by ID
    HAVING count(STA) > 1
    ) B
    where A.ID = B.ID
    OR A.STA = '0'
    The second I came up with was.
    select B.Id , A.id STA
    from test_STA A, test_STA B
    where A.STA = '0'
    AND B.STA != '0'
    AND B.STA = A.ID
    AND b.TXN < 0
    Where the data looks like
    create table test_STA
    ( TXN NUMBER,
    ID VARCHAR2(20),
    STA VARCHAR2(20) )
    insert into test_STA Values (1, '1', '0')
    insert into test_STA Values (-1, '1', '1')
    insert into test_STA Values (-1, '1', 'A')
    insert into test_STA Values (-1, '1', 'B')
    insert into test_STA Values (-1, 'A', '1')
    insert into test_STA Values (-1, 'B', '1')
    insert into test_STA Values (-1, '2', '0')
    TXN is the transaction number -1 is current, others (> 0 are old)
    What does all this mean..
    Well
    1 is a parent, with A and B as children.
    2 is a parent with no children.
    So what I want to do return is Parents with no children, and children but not their parents..
    So which path should I continue my efforts down do you think ? The first one, with the group by, or the second one, with the join to it's self.
    Paul

    Hi,
    If you can guarantee, that every child has also a record then following query returns your result:
    select ID, count(*)
    from test_STA
    group by ID
    having count(*) = 1
    ID COUNT(*)
    2     1
    A     1
    B     1

  • How to achieve parent-child relationship using self join?

    my table structure is as follows
    parent child name
    -1     1     A1
    1     2     A2
    1     3     A3
    how to achieve the hierarchy model using self join. this can be easily achieved using "connect by prior". but how to achieve the same using self join?

    Hi,
    Yes, that's definitely possible. If you only need to display two levels from the hierarchy, a self-join is a good option. Make it an outer join if you need to show everyone on one level, regardless of whether they have a match on the other level or not; for example, if you want the output:
    child_name     child_id     parent_name     parent_id
    A1          1
    A2          2          A1          1
    A3          3          A1          1It's good that you posted some sample data. Now post the results you want from that data, and your query (what you think is the best attempt you've made so far). If you haven't tried anything so far, then look at some other simple self-join to get ideas.

  • Oracle doc inconsistent on materialize view with union all and self joins

    First of all, I can't seem to create a materialized view containing self-joins AND union all. Is it possible?
    I checked Oracle 9i (my version: PL/SQL Release 9.2.0.4.0 - Production) documentation and I get different answers (or so it seems to me).
    First I saw this: "The COMPATIBILITY parameter must be set to 9.0 if the materialized aggregate view has inline views, outer joins, self joins or grouping sets and FAST REFRESH is specified during creation..."
    Did you see the part about 'self joins' in there? I did and I was pumped because that seems to say that you CAN have 'self joins' (and my compatibility is 9.2...)
    BUT
    In the very same document I also found "Oracle does not allow self-joins in materialized join views." (rage)
    You can see the document I am speaking of here: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/mv.htm#574889
    Whenever I try to create the mview I get the following error. (
    In any caseORA-01446 cannot select ROWID from view with DISTINCT, GROUP BY, etc.

    First of all, I can't seem to create a materialized view containing self-joins AND union all. Is it possible?
    I checked Oracle 9i (my version: PL/SQL Release 9.2.0.4.0 - Production) documentation and I get different answers (or so it seems to me).
    First I saw this: "The COMPATIBILITY parameter must be set to 9.0 if the materialized aggregate view has inline views, outer joins, self joins or grouping sets and FAST REFRESH is specified during creation..."
    Did you see the part about 'self joins' in there? I did and I was pumped because that seems to say that you CAN have 'self joins' (and my compatibility is 9.2...)
    BUT
    In the very same document I also found "Oracle does not allow self-joins in materialized join views." (rage)
    You can see the document I am speaking of here: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96520/mv.htm#574889
    Whenever I try to create the mview I get the following error. (
    In any caseORA-01446 cannot select ROWID from view with DISTINCT, GROUP BY, etc.

  • Student learning, self join

    Our teacher isnt very clear on self joins, and searching brings up too complicated of info for someone like myself just learning, so i was hoping you guys could help out. Table below:
    SQL> select * from grade;
    STD_CODE GR_LNAME GR_FNAME GR_T1 GR_T2 GR_HW GR_PR
    S1 Jordan Michael 95 80 98 90
    S2 Barkley Charles 60 100 100 60
    S3 Johnson Magic 88 98 96 98
    S4 Williams Serena 92 92 92 92
    S5 Duncan Tim 94 90 94 96
    S6 Graff Steffi 85 84 83 72
    S7 Navratilova Martina 91 88 94 95
    Need to solve this question:
    Create a view that will display names of students that have identical average grade (average of gr_t1, t2, hw, and pr)
    I learned that we needed to create a self join to sniff out the averages that were the same.
    I am pretty clueless on the logic of self join, but I made an attempt:
    CREATE VIEW SAME_GRADES2 AS SELECT S.STD_FNAME, S.STD_LNAME, (GR_T1+GR_T2+GR_HW+GR_PR)/4 AVG_GR
    FROM GRADE S, GRADE G
    WHERE S.AVG_GR=G.AVG_GR;
    i get an error on this: ORA-00904: "G"."AVG_GR": invalid identifier
    No idea. Any help for a newbie?

    sorry that last one was a syntax error... here is the result (obviously not what i need)
    GR_FNAME GR_LNAME AVG_GR
    Michael________Jordan____________90.75
    Charles________Barkley____________80
    Magic________Johnson____________95
    Martina________Navratilova_________92
    Serena________Williams____________92
    Tim________Duncan______________93.5
    Steffi________Graff _______________81
    Martina________Navratilova _________92
    Serena________Williams____________92
    9 rows selected.
    code:
    CREATE VIEW SAME_GRADES2 AS SELECT S.GR_FNAME, S.GR_LNAME, (S.GR_T1+S.GR_T2+S.GR_HW+S.GR_PR)/4 AVG_GR
    FROM GRADE S, GRADE G GROUP BY S.GR_FNAME
    WHERE (S.GR_T1+S.GR_T2+S.GR_HW+S.GR_PR)/4 = (G.GR_T1+G.GR_T2+G.GR_HW+G.GR_PR)/4;
    Edited by: user10188205 on Oct 22, 2008 4:42 PM

  • How to re-write this self join update using a CTE

    I would like to improve my performance on this update statement and would like to try re-writing using a CTE:
    UPDATE "usr_sessions" "a" SET "is_ended_at_trustable" = 't'
          WHERE (
            EXISTS (
              SELECT 1
              FROM "usr_sessions" "b"
              WHERE "a"."ended_at" = "b"."started_at"
                AND "a"."usr_space_id" = "b"."usr_space_id"
                AND "a"."account_id" = "b"."account_id"
          ) ) AND "a"."is_ended_at_trustable" IS NULL
    Any help is greatly appreciated!  Open to other suggestions as well if there is a better way!

    If I understood your description correctly, here's a way to accomplish the same thing, while dodging the need for the self join.   The update itself won't be any faster, but the overall query leading to the update will likely be faster sans self-join.
      (If my interpretation wasn't exactly what you meant, tweak the "partition by" clause).
    MERGE is generally considered better then UPDATE, but your particular update isn't at risk for the shortcomings of update (still, Merge is newer, cooler, and more trustworthy).
    Setup_Example_Data:
    Declare @Usr_Sessions table (account_id int, usr_space_id int, is_ended_at_Trustable Char(1), started_at varchar(99), ended_at varchar(99))
    Insert @Usr_Sessions
    Select 1, 10, 't', 'A1', 'A1'
    UNION ALL Select 2, 20, 'f', 'B1', 'B2'
    UNION ALL Select 3, 30, NULL, 'C1', 'C1'
    UNION ALL Select 4, 40, NULL, 'D1', 'D2'
    UNION ALL Select 5, 50, NULL, 'E1', 'E2'
    UNION ALL Select 5, 51, NULL, 'E3', 'E3'
    UNION ALL Select 6, 61, NULL, 'F1', 'F2'
    UNION ALL Select 6, 62, 't', 'F3', 'F3'
    UNION ALL Select 6, 62, 'f', 'F4', 'F4'
    Select 'Before', * from @Usr_Sessions
    OP_Query:
    BEGIN TRAN
    UPDATE A SET is_ended_at_trustable = 't' from @usr_Sessions A-- Select * from @Usr_Sessions "a" --
    WHERE (
    EXISTS (
    SELECT 1
    FROM @usr_sessions "b"
    WHERE "a"."ended_at" = "b"."started_at"
    AND "a"."usr_space_id" = "b"."usr_space_id"
    AND "a"."account_id" = "b"."account_id"
    ) ) AND "a"."is_ended_at_trustable" IS NULL
    Select 'After 1', * from @Usr_Sessions
    ROLLBACK TRAN /* Just to reset test data to original form, so second query below runs against original data */
    Dodge_Self_Join:
    With X as
    Select *
    , count(case when started_at = ended_at and is_ended_at_trustable is null then 'x' else null end)
    over(partition by account_id, usr_space_id) as Updatable
    From @Usr_Sessions
    Update X
    set is_ended_at_Trustable = 'T'
    where Updatable > 0 -- EDIT -- fixed error, previously said "updatable = 1"
    Select 'After 2', * from @Usr_Sessions

  • Self join in the HR schema

    I'm a beginner going though a tutorial on joins using the HR schema:
    an example of a self join was given as:
    SELECT e.last_name AS Employee, m.last_name AS Manager
    FROM employees e INNER JOIN employees m
    ON (e.manager_id = m.employee_id);
    this executes correctly, giving a column of Employee's name and their manager's name . However, I'm having trouble wrapping my head around the ON clause in this statement.
    For example if I change the ON clause so that the statement is:
    SELECT e.last_name AS Employee, m.last_name AS Manager
    FROM employees e INNER JOIN employees m
    ON (m.manager_id = e.employee_id);
    I no longer get the correct answer but I'm not sure why?

    You are getting different result because:
    993451 wrote:
    I'm a beginner going though a tutorial on joins using the HR schema:
    an example of a self join was given as:
    SELECT e.last_name AS Employee, m.last_name AS Manager
    FROM employees e INNER JOIN employees m
    ON (e.manager_id = m.employee_id);
    earlier you were joining employee's manager_id with manager's employee_id.
    this executes correctly, giving a column of Employee's name and their manager's name . However, I'm having trouble wrapping my head around the ON clause in this statement.
    For example if I change the ON clause so that the statement is:
    SELECT e.last_name AS Employee, m.last_name AS Manager
    FROM employees e INNER JOIN employees m
    ON (m.manager_id = e.employee_id);
    now you are joining manager's manager_id with employee's employee_id
    I no longer get the correct answer but I'm not sure why?
    Now, can you make out the difference between the logic you are applying.
    Regards,
    Ankit Rathi
    http://oraclenbeyond.blogspot.in

  • Performance Tuning - Self Join Issue

    Hi,
    The following query takes long time to execute. Is there any better way to
    re-writing the query to reduce the time it takes to execute.
    INSERT INTO TT_TEMP_MAINGUI_SP_PERCENT_MOV
    (prev_prc_dt,asset_id,pricing_pt_id,price_dt)
    SELECT max(tpm2.prc_dt),
    tpm2.asset_id ,
    tpm2.pricing_pt_id ,
    tpm1.prc_dt
    FROM t_prc_master tpm1,
    t_prc_master tpm2
    WHERE tpm1.prc_dt = '19-Dec-07'
    AND tpm1.asset_id = tpm2.asset_id
    AND tpm1.pricing_pt_id = tpm2.pricing_pt_id
    AND tpm2.prc_dt < tpm1.prc_dt
    AND tpm2.accept_flg = 'Y'
    AND tpm1.accept_flg = 'Y'
    AND EXISTS (SELECT 1 FROM t_temp_prcmov
    WHERE pca_flg = 'P'
    AND tpm1.pricing_pt_id = prc_pt_cntry_atyp)
    GROUP BY tpm2.asset_id, tpm2.pricing_pt_id,tpm1.prc_dt;
    select count(*) from t_prc_master
    where prc_dt = '19-Dec-07'
    COUNT(*)
    784161
    -- Here is the TKPROF Output
    INSERT INTO TT_TEMP_MAINGUI_SP_PERCENT_MOV
    (prev_prc_dt,asset_id,pricing_pt_id,price_dt)
    SELECT max(tpm2.prc_dt),
    tpm2.asset_id ,
    tpm2.pricing_pt_id ,
    tpm1.prc_dt
    FROM t_prc_master tpm1,
    t_prc_master tpm2
    WHERE tpm1.prc_dt = '19-Dec-07'
    AND tpm1.asset_id = tpm2.asset_id
    AND tpm1.pricing_pt_id = tpm2.pricing_pt_id
    AND tpm2.prc_dt < tpm1.prc_dt
    AND tpm2.accept_flg = 'Y'
    AND tpm1.accept_flg = 'Y'
    AND EXISTS (SELECT 1 FROM t_temp_prcmov
    WHERE pca_flg = 'P'
    AND tpm1.pricing_pt_id = prc_pt_cntry_atyp)
    GROUP BY tpm2.asset_id, tpm2.pricing_pt_id,tpm1.prc_dt
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 226.01 317.50 1980173 4915655 805927 780544
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 226.01 317.51 1980173 4915655 805927 780544
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 98 (PRSDBO)
    Rows Row Source Operation
    780544 SORT GROUP BY (cr=4915236 r=1980165 w=0 time=312751120 us)
    40416453 NESTED LOOPS (cr=4915236 r=1980165 w=0 time=245408132 us)
    783459 NESTED LOOPS (cr=956325 r=92781 w=0 time=17974163 us)
    55 TABLE ACCESS FULL T_TEMP_PRCMOV (cr=3 r=0 w=0 time=406 us)
    783459 TABLE ACCESS BY INDEX ROWID T_PRC_MASTER (cr=956322 r=92781 w=0 time=17782856 us)
    784161 INDEX RANGE SCAN PRC_DT_ASSET_ID (cr=412062 r=69776 w=0 time=14136725 us)(object id 450059)
    40416453 INDEX RANGE SCAN ASSET_DT_ACCEPT_FLG (cr=3958911 r=1887384 w=0 time=217215303 us)(object id 450055)
    Rows Execution Plan
    0 INSERT STATEMENT GOAL: CHOOSE
    780544 SORT (GROUP BY)
    40416453 NESTED LOOPS
    783459 NESTED LOOPS
    55 TABLE ACCESS GOAL: ANALYZED (FULL) OF 'T_TEMP_PRCMOV'
    783459 TABLE ACCESS GOAL: ANALYZED (BY INDEX ROWID) OF
    'T_PRC_MASTER'
    784161 INDEX GOAL: ANALYZED (RANGE SCAN) OF 'PRC_DT_ASSET_ID'
    (NON-UNIQUE)
    40416453 INDEX GOAL: ANALYZED (RANGE SCAN) OF 'ASSET_DT_ACCEPT_FLG'
    (UNIQUE)
    Could somebody help me in resolving the issue? It would be appreciated...

    Well, it's a bit of a mess to read. Please use the pre or code tags enclosed in [] next time to preserve the formatting of the code.
    First thing that looks 'bad' to me is
    WHERE tpm1.prc_dt = '19-Dec-07'which should be (i assume you want 2007 and not 1907)
    WHERE tpm1.prc_dt = TO_DATE('19-Dec-2007', 'DD-MON-YYYY');The next thing i'm very confused with is...why are you self joining the table? You should be able to just do this.....logically, it should produce the same results, though it's obviously not tested :D)
    SELECT
       max(tpm2.prc_dt),
       tpm2.asset_id ,
       tpm2.pricing_pt_id ,
       TO_DATE('19-Dec-2007', 'DD-MON-YYYY')  AS prc_dt
    FROM t_prc_master tpm2
    WHERE tpm2.prc_dt < TO_DATE('19-Dec-2007', 'DD-MON-YYYY')
    AND   tpm2.accept_flg = 'Y'
    AND   EXISTS   ( 
                      SELECT
                         NULL
                      FROM t_prc_master tpm1
                      WHERE tpm1.prc_dt          = TO_DATE('19-Dec-2007', 'DD-MON-YYYY')
                      AND   tpm1.asset_id        = tpm2.asset_id
                      AND   tpm1.pricing_pt_id   = tpm2.pricing_pt_id
                      AND   tpm1.accept_flg      = 'Y'                 
                      AND   tpm1.pricing_pt_id  IN (SELECT tmov.prc_pt_cntry_atyp FROM t_temp_prcmov tmov WHERE tmov.pca_flg = 'P')
    GROUP BY tpm2.asset_id, tpm2.pricing_pt_id, TO_DATE('19-Dec-2007', 'DD-MON-YYYY');Message was edited by:
    Tubby

  • How to Avoid Self Join

    Hi
    Assume I have following table
    Id Code
    1 aa
    1 bb
    1 cc
    2 bb
    2 cc
    The records will be grouped by Id. I want to find out group containing code say 'aa' and 'bb'.
    Is it possible to obtain the desired result in a single query without using Self join?
    Regards
    ~Pravin

    This is a little clumsy....Anyway try it:
    WITH t AS
    (SELECT 1 id,'aa' code FROM dual
    UNION ALL
    SELECT 1,'bb' FROM dual
    UNION ALL
    SELECT 1,'cc' FROM dual
    UNION ALL
    SELECT 2,'bb' FROM dual
    UNION ALL
    SELECT 2,'cc' FROM dual)
    SELECT id FROM t
    WHERE code IN('aa', 'bb')
    GROUP BY id HAVING COUNT(*) = 2;

  • Tuning question. Self join vs Analytical function

    Hi all,
    I am a bit confused about this query cost.
    So I have this query. Now follow the original one (after rewritten by me):
    SELECT /*+ parallel (d 8) parallel(h 8) parallel(c 8) */
         DISTINCT
    d.customer_node_id AS root_customer_node_id,
    d.customer_node_id AS customer_node_id,
    nvl(h.account_id,c.account_id) AS account_id,
    nvl(h.account_name,c.account_name) AS account_name,
    d.service_id AS service_id,
    nvl((SELECT /*+ parallel(x 8) */ max(x.service_name) FROM delta_service_history x
    WHERE x.service_id=d.service_id AND v_upperbound_upd_dt BETWEEN x.effective_start_date AND x.effective_end_date GROUP BY x.service_id),d.service_name) AS service_name
    FROM
    delta_service_history d,
    delta_account c,
    stg_hierarchy h
    WHERE
    d.customer_node_id=c.customer_node_id(+) AND
    d.customer_node_id=h.customer_node_id(+)
    ......the new one (I decided to use analitycal function to calculate max(service_name) for each service_id instead of self join done for "delta_service_history" )
    I thought that self join was very heavy....
    Anyway, my two questions are:
    1. why the second one is heavier than the first. I reduce the number of join.....
    2. how can be rewritten the first one query? In particular way I don't like that self join..... :)
    Select Distinct
                   root_customer_node_id,
                   customer_node_id,
                   account_id,
                   account_name,
                   service_id,
    service_name
                   From
                                  SELECT /*+ parallel (d 8) parallel(h 8) parallel(c 8) */
                                  d.customer_node_id AS root_customer_node_id,
                                  d.customer_node_id AS customer_node_id,
                                  nvl(h.account_id,c.account_id) AS account_id,
                                  nvl(h.account_name,c.account_name) AS account_name,
                                  d.service_id AS service_id,
                                  d.service_name,
                                  row_number() over (partition by d.service_id order by d.service_name desc) r1
                             FROM
                                  delta_service_history d,
                                  delta_account c,
                                  stg_hierarchy_new h
                             WHERE
                                  d.customer_node_id=c.customer_node_id(+) AND
                                  d.customer_node_id=h.customer_node_id(+) AND
                                  v_upperbound_upd_dt BETWEEN d.effective_start_date AND d.effective_end_date
                             )a
                        Where a.r1 = 1
    Thank you all.

    I Post query plan.
    First one query (the original):
    Plan
    MERGE STATEMENT ALL_ROWSCost: 2.691.669 Bytes: 784.141.119.324 Cardinality: 1.754.230.692                                                                            
         27 MERGE STGADMIN.STG_HIERARCHY                                                                       
              26 PX COORDINATOR                                                                  
                   25 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10005 :Q1005Cost: 2.691.669 Bytes: 475.396.517.532 Cardinality: 1.754.230.692                                                             
                        24 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1005                                                       
                             23 HASH JOIN RIGHT OUTER BUFFERED PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 2.691.669 Bytes: 475.396.517.532 Cardinality: 1.754.230.692                                                   
                                  4 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1005                                             
                                       3 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                         
                                            2 PX SEND HASH PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                    
                                                 1 TABLE ACCESS FULL TABLE STGADMIN.STG_HIERARCHY Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                               
                                  22 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 2.669.426 Bytes: 376.698.378.630 Cardinality: 1.752.085.482                                              
                                       21 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10004 :Q1004Cost: 2.669.426 Bytes: 376.698.378.630 Cardinality: 1.752.085.482                                         
                                            20 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1004Cost: 2.669.426 Bytes: 376.698.378.630 Cardinality: 1.752.085.482                                    
                                                 19 SORT UNIQUE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 2.669.426 Bytes: 127.902.240.186 Cardinality: 1.752.085.482                               
                                                      18 HASH JOIN OUTER PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 35,386 Bytes: 127.902.240.186 Cardinality: 1.752.085.482                          
                                                           13 HASH JOIN OUTER PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 4,86 Bytes: 647.395.154 Cardinality: 13.212.146                     
                                                                8 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 1,961 Bytes: 158.611.600 Cardinality: 6.344.464                
                                                                     7 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10001 :Q1001Cost: 1,961 Bytes: 158.611.600 Cardinality: 6.344.464           
                                                                          6 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1001Cost: 1,961 Bytes: 158.611.600 Cardinality: 6.344.464      
                                                                               5 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.DELTA_SERVICE_HISTORY :Q1001Cost: 1,961 Bytes: 158.611.600 Cardinality: 6.344.464
                                                                12 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120                
                                                                     11 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120           
                                                                          10 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120      
                                                                               9 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.STG_HIERARCHY :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120
                                                           17 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622                     
                                                                16 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10003 :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622                
                                                                     15 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622           
                                                                          14 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.DELTA_ACCOUNT :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622      
    ...second query
    Plan
    MERGE STATEMENT ALL_ROWSCost: 3.521.711 Bytes: 291.687.979.305 Cardinality: 652.545.815                                                                                                     
         32 MERGE STGADMIN.STG_HIERARCHY                                                                                                
              31 PX COORDINATOR                                                                                           
                   30 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10006 :Q1006Cost: 3.521.711 Bytes: 176.839.915.865 Cardinality: 652.545.815                                                                                      
                        29 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1006                                                                                
                             28 HASH JOIN RIGHT OUTER BUFFERED PARALLEL_COMBINED_WITH_PARENT :Q1006Cost: 3.521.711 Bytes: 176.839.915.865 Cardinality: 652.545.815                                                                            
                                  4 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1006                                                                      
                                       3 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1006Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                                                  
                                            2 PX SEND HASH PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                                             
                                                 1 TABLE ACCESS FULL TABLE STGADMIN.STG_HIERARCHY Cost: 20,828 Bytes: 860.278.720 Cardinality: 15.362.120                                                        
                                  27 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1006Cost: 3.500.345 Bytes: 140.125.783.665 Cardinality: 651.747.831                                                                       
                                       26 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10005 :Q1005Cost: 3.500.345 Bytes: 140.125.783.665 Cardinality: 651.747.831                                                                  
                                            25 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1005Cost: 3.500.345 Bytes: 140.125.783.665 Cardinality: 651.747.831                                                             
                                                 24 SORT UNIQUE PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 3.500.345 Bytes: 121.225.096.566 Cardinality: 651.747.831                                                        
                                                      23 VIEW PARALLEL_COMBINED_WITH_PARENT STGADMIN. :Q1005Cost: 1.195.554 Bytes: 121.225.096.566 Cardinality: 651.747.831                                                   
                                                           22 WINDOW SORT PUSHED RANK PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 1.195.554 Bytes: 58.005.556.959 Cardinality: 651.747.831                                              
                                                                21 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1005Cost: 1.195.554 Bytes: 58.005.556.959 Cardinality: 651.747.831                                         
                                                                     20 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10004 :Q1004Cost: 1.195.554 Bytes: 58.005.556.959 Cardinality: 651.747.831                                    
                                                                          19 WINDOW CHILD PUSHED RANK PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 1.195.554 Bytes: 58.005.556.959 Cardinality: 651.747.831                               
                                                                               18 HASH JOIN OUTER PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 34,402 Bytes: 58.005.556.959 Cardinality: 651.747.831                          
                                                                                    13 HASH JOIN OUTER PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 4,859 Bytes: 319.455.955 Cardinality: 4.914.707                     
                                                                                         8 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 1,963 Bytes: 152.576.580 Cardinality: 3.721.380                
                                                                                              7 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10001 :Q1001Cost: 1,963 Bytes: 152.576.580 Cardinality: 3.721.380           
                                                                                                   6 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1001Cost: 1,963 Bytes: 152.576.580 Cardinality: 3.721.380      
                                                                                                        5 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.DELTA_SERVICE_HISTORY :Q1001Cost: 1,963 Bytes: 152.576.580 Cardinality: 3.721.380
                                                                                         12 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120                
                                                                                              11 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10002 :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120           
                                                                                                   10 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120      
                                                                                                        9 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.STG_HIERARCHY :Q1002Cost: 2,879 Bytes: 368.690.880 Cardinality: 15.362.120
                                                                                    17 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1004Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622                     
                                                                                         16 PX SEND HASH PARALLEL_TO_PARALLEL SYS.:TQ10003 :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622                
                                                                                              15 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622           
                                                                                                   14 TABLE ACCESS FULL TABLE PARALLEL_COMBINED_WITH_PARENT STGADMIN.DELTA_ACCOUNT :Q1003Cost: 28,982 Bytes: 5.838.854.928 Cardinality: 243.285.622

  • Weird things happed on self-joining

    I have a transaction table like follows
    date orderno product
    30-May-01,1030016,JR PEPPERCORNS BLACK,Herbs & Spices
    30-May-01,1030016,JR VSS LAMB SEAS,Herbs & Spices
    CREATE OR REPLACE TYPE transaction_objtyp AS OBJECT (tid NUMBER(32), transitem itemlist_ntabtyp);
    CREATE TABLE transaction_objtab OF transaction_objtyp (primary key (tid))
    NESTED TABLE item STORE AS itemlist_ntab;
    When trying to sort out the orderno by self-join,
    INSERT INTO transaction_objtab
    SELECT o1.orderno, NULL
    FROM order_tab o1, order_tab o2
    WHERE o1.orderno > o1.orderno;
    the system seems get into deadlock. Further queries are responded by
    ORA-04031: unable to allocate 2520 bytes of shared memory ("large pool","unknown object","session heap","koh-kghu session heap")
    I tried to drop table
    drop table transaction_objtab force;
    but the system would not allow me, and says:
    drop table transaction_objtab force
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified

    This is what happens on my 8.1.7 system (with some changes required):
    SQL> drop table Order_tab
      2  /
    Table dropped.
    SQL> drop table transaction_objtab
      2  /
    Table dropped.
    SQL> drop type transaction_objtyp
      2  /
    Type dropped.
    SQL> drop type itemlist_ntabtyp
      2  /
    Type dropped.
    SQL> drop type item_objtyp
      2  /
    Type dropped.
    SQL> CREATE OR REPLACE TYPE item_objtyp AS OBJECT (item varchar(100));
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE itemlist_ntabtyp AS TABLE OF item_objtyp;
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE transaction_objtyp AS OBJECT (tid NUMBER(32), transitem itemlist_ntabtyp);
      2  /
    Type created.
    SQL> CREATE TABLE transaction_objtab OF transaction_objtyp (primary key (tid))
      2  NESTED TABLE transitem STORE AS itemlist_ntab;
    Table created.
    SQL>
    SQL> CREATE TABLE Order_tab(
      2  OrderDate DATE,
      3  OrderNo VARCHAR(20) PRIMARY KEY,
      4  ProductDesc VARCHAR2(150),
      5  ProductType VARCHAR2(50),
      6  Qty NUMBER,
      7  Branch VARCHAR2(100),
      8  Merchandiser VARCHAR2(100));
    Table created.
    SQL>
    SQL> INSERT INTO transaction_objtab
      2  SELECT o1.orderno, NULL
      3  FROM order_tab o1, order_tab o2
      4  WHERE o1.orderno > o1.orderno;
    0 rows created.
    SQL>

  • Self join with fact table in Obie 10G

    I am a newbie to obiee.I have a development requirement as follows-
    I need to find supervisors designation with the existing star RPD design. explanation is below
                                                        DIM_Designation(Desig_Wid)
                                                      |(Row_wid)
                                                      |
    DIM_EMPLOYEE--------WORKER_FACT------------DIM_Supervisor
    (Row_Wid)-----------------(Employee_Wid)
                                      (Supervisor_Wid)------------(Row_Wid)
    3 dimension is joined to fact to get employee, his supervisor and designation of employee. now i want to get the supervisor's designation? how is it possible? already employee and supervisor dimension is same W_employee_d table joined with fact as alias DIM_EMPLOYEE and DIM_SUPERVISOR. how to do self join with fact to get supervisor's designation. i do not have any supervisor_desig_wid in fact table. any help is deeply appreciated.

    Yes,Duplicate the fact table create a primary key on the newly fact table alias dimension table.So you can ur data modelling as usual.

Maybe you are looking for

  • Virtual cube with function module

    hi I wrote function module which is used with virtual cube. When I launch query build on this cube in the BEX i can't interrupt execution of function module. How to put break point. may be there is any option that could turn off debugging?

  • ME59N - Customize it to change POs?  User Exit?

    Hi all, We are using the automatic PO creation program (ME59N) to convert approved requisitions with a fixed source of supply to purchase orders. We have scenarios at our company where, after the PO is created and sent to the vendor, a change is to b

  • Bootcamp will not load Windows installer - No bootable device, insert disk then press any key

    Hello, I recently decided to install bootcamp onto my 2009 27" iMac, I have done this before for other people's computers and I thought it would be no different for my own. However, on attempt to install the Windows disk, instead of starting the inst

  • Extremely URGENT! How to pass a parameter from html to form?

    Hi Guys, I want to be able to pass a parameter to a Pre-Query trigger (from a html page to an Oracle form.) Right now, I hard coded the Pre-Query trigger (i.e. set_block_property('datablock_name', default_where, 'tableName.fieldName = '||:datablock.f

  • Dynamic VLAN assignment and DHCP

    Hello I have just upgraded our WLC from 4.0 to 7.0 (via 4.2). Before the upgrade we had our ACS returning a VLAN based on user group.  This seemed to be working without an issue.  Now that the WLC is on version 7 this is no longer working correctly.