How to undo "select distinct" in OBIEE

Hello guys
I found that pretty much in all the reports that we created in OBIEE, the presentation service would generate SQL that starts with "select distinct" when I view the query log..
I'd like to know what configuration in the Admin Tool or presentation service is controlling this behavior of OBIEE. For some reason as I am tuning the performance by running the same query in DB, the same query without "distinct" can go so much faster than the original one from OBIEE.. So I'd like to configure my RPD so that certain reports will not have "select distinct". I know that by default, the BI server will always generate a "distinct", but is there a way to override this default, if not, what might be some performance tuning tactics I can use?
Any thoughts?
Thanks
Edited by: user7276913 on Oct 27, 2009 8:20 PM

BenS wrote:
Two issues with this that I encountere:
When I selected the first suggested option at the Physical Layer for the database, I found the "DISTINCT SUPPORTED" option. There were two columns checked: Value and Default. I was able to unselect Value but not Default.
(1) What is the difference between Value and Default?
(2) If I only unselect Value will it stop Answers from adding the DISTINCT to every query created?
Second, when I selected the source from the business model mapping, it already did not have the DISTINCT box checked. Therefore, I could not limit this at the Logical layer as I would have preferred.
If you could help me understand the first option it may clarify how to implement option # 2.
Thanks...1) the defaults are stored in an .ini file and serve the purpose of defining the defaults when you hit the 'revert to default' button.
If you unselect value, you are telling OBIEE that the database for which you are changing these options does not support the distinct clause, I doubt you wish to do this across the entire application.
I think you will find that OBIEE applies the distinct :
1) when the LTS has distinct ticked.
2) When the column in question is not part of a dimension hierachy key (if it is, your telling the OBIEE server these should be unique, so wont issue the distinct)
or
3) the column forms part of a key in either logical BMM layer or as part of a physical key.
adding the column to a Dim Hierachy wont be an option in most cases, you could try playing with just setting this column as a key on the BMM layer or Physical layer , and let us know if this helps.

Similar Messages

  • Select distinct('more than one column') from ....

    Why does this sql statement not work:
    select distinct(column_a, column_b, column_c), empno
    from emp;
    How can I 'select distinct' using more than one column.

    Actually, DISTINCT applies to all columns in the result.
    Distinct is not a function, you cannot do distinct(column1, column2, ...).
    As a matter of fact it doesn't make sense to expect distinct applies to only one column, because you do not specify any criteria on how to select the values for the second column.
    A final note: you can do distinct(column1), column2, but this will still apply to both columns!
    Here're some examples that will all return both rows from the set, where set is: (1,1), (1,2):
    select distinct val1, val2
    from
    select 1 as val1, 1 as val2 from dual
    union all
    select 1 as val1, 2 as val2 from dual
    select distinct val1||'-'||val2
    from
    select 1 as val1, 1 as val2 from dual
    union all
    select 1 as val1, 2 as val2 from dual
    select distinct(val1), val2 -- this is very misleading. distinct still applies to both columns
    from
    select 1 as val1, 1 as val2 from dual
    union all
    select 1 as val1, 2 as val2 from dual
    Edited by: user4010726 on Dec 1, 2009 11:06 AM
    Edited by: user4010726 on Dec 1, 2009 11:07 AM

  • How to select distinct values from a table when it has composite primary ke

    Hi
    I have the requirement like , I need to select distinct one column values from the table which has composite primary key. How to acheive this functioinality using view object.
    Eg : Table 1 has col1 and col2, col3
    col1 col2 col3
    1 A NA
    1 B NA
    2 A NA
    3 C NA
    2 D NA
    primary key (col1,col2)
    I have to select distinct col1.
    Thanks

    Hi
    I got the solution for above. By Creating the read only view object we can acheive this.
    thanks

  • Select distinct cardno how ti implement in owb

    Hi, everyone,
    i am quiet new to owb and i want to know how to use the distinct in owb...
    my query is
    select distinct cardno,brand_edesc
    from table tlog where
    edesc = 'AAAA'
    and tmonth >=200807 and tmonth<=200809
    so my question is
    for the where clause i use the filter operator now i want know in owb what operator do we use to select distinct ????
    Thanks a many

    You can use Deduplicator operator.
    Drag the Deduplicator operator and pass cardno,brand_edesc to it .
    Cheers
    Nawneet

  • How to avoid DISTINCT in OBIEE SQL

    Hi...
    For question i posted previously...
    Problem with LONG datatype in Answers
    I run the query in TOAD, and i was identified the error because of what this error is coming... because of DISTINCT...
    I have taken care of avoiding that column in ORDER BY by putting the order by on another column..
    Now my question is how to avoid the DISTINCT clause in SQL generated by OBIEE...
    If the first column in criteria is measure then it avoids the DISTINCT... but if i use measure... group by will come.. and group by should not be used here...
    If this is done... my problem will be resolved...
    Ofcourse... i would be getting duplicate rows...
    Still i want the answer how to avoid DISTINCT?
    Expecting answer from you...
    Thanks & Regards
    Kishore Guggilla

    Hi...
    Thanks for reply...
    Now another question.. if i want to do this for one report... how?/
    If i do that change in Catalog properties.. that will be effected for all reports i think...
    Instead of that if i want to do that for only one report.. which is effecting... then how to proceed??
    I tried by writing case when 1=0 ... for first column in criteria.. but no luck...
    Thanks & Regards
    Kishore Guggilla

  • How to select distinct rows ..?

    Hi all...
    I am having one table with many columns. I want to select distinct rows from one column and for each row selected, i want to have one unique number.
    For ex:
    SELECT DISTINCT SUM(ROWNUM) OVER(ORDER BY C.SPECIFICATION NULLS LAST) AS CODE,
    C.SPECIFICATION FROM TABLE_1 C WHERE condition.
    In this case, there is a chance of getting duplicate values (1 and 4 rows selected = total 5) and (3 and 2 rows selected = total 5)
    i thought of selecting through sub query like this
    select rownum, code from (select distinct SPECIFICATION as code from table where ...)
    Is there anymore options to get the desired output.
    Thanks in advance,
    Pal

    try like this:
    select distinct
           dense_rank() over(order by c.specification) as code,
           c.specification
      from table_1 c
    where condition

  • I found My iPhone contacts on my friends Iphone we both have 4s! But we use the same apple ID and ICloud ID! How can undo what happened? all my private stuff is now on his phone!!! help me plz!!?

    I found My iPhone contacts on my friends Iphone we both have 4s! But we use the same apple ID and ICloud ID! How can undo what happened? all my private stuff is now on his phone!!! help me plz!!?

    Of course if you are both connected to the same iCloud account you have the same contacts - what did you expect?. The contacts live on the server and are read from there by the devices; so as you've both managed to sync your contacts up to iCloud they are now inextricably mixed. You can only delete your contacts by deleting individual ones, and doing that will delete them from your phone as well.
    You can only unravel this by
    1. In the iCloud contacts page at http://icloud.com, select all the contacts, click on the cogwheel icon at bottom left and choose 'Export vCard'.
    2. Sign out of System Preferences>iCloud
    3. Create a new Apple ID and open a new iCloud account with it for your own use.
    4. Import the vCard back into the iCloud contacts page.
    5. Go to http://icloud.com and sign in with the original ID. This is now his ID. Work through the contacts individually deleting the ones you don't want him to have. When done sign out and advise him to change his password.
    6. Go to the new iCloud account and delete his contacts individually.
    Of course if you have also been syncing calendars and using the same email address there are problems with doing this.

  • How can I remove distinct from subquery?

    Hello, I'll expose my problem, I don't know if may be is a bug.
    Suppose We have
    Table A:
    field A1 primary key
    field A2
    field A3
    Table B
    field B1 primary key
    field B2 foreig key to A(A1)
    field B3
    I use reverse tool to build objects from DB schema.
    Everything runs ok but when I want to recover A objects
    with sum(B3) from B,it doesn't runs fine.
    To achieve this I've made a class C with fields of class A and a double
    for sum. The code I've use is:
    KodoQuery query = (KodoQuery)getPersistenceManager()
    .newQuery(A.class, "this == b.b2");
    query.declareVariables("B b");
    query.declareImports("x.x.B");
    query.setResultClass(C.class);
    query.setResult("this as a, sum(b.b3) as s");
    query.setGrouping("a");
    Collection c = query.execute();
    I use PostGreSQL 7.4, and the sql that Kodo generates is like this:
    SELECT s.A1, SUM(s.C) AS c
    FROM ( SELECT DISTINCT a.A1 AS A1, s.B3 AS C
    FROM PUBLIC.A a INNER JOIN PUBLIC.B b ON (a.A1 = b.B2) ) s
    GROUP BY s.A1
    But the problem is 'DISTINCT' keyword. If I have records on B
    with same B3 value then:
    B1=1,B2=1,B3=25
    B1=2,B2=1,B3=25
    The query returns SUM(B3)=25 which is not valid!!!, it must be 50.
    It fails with repeated B3 values because distinct keyword.
    I bypass this adding a third field to class C that I will not use, and
    introduce it into query:
    KodoQuery query = (KodoQuery)getPersistenceManager()
    .newQuery(A.class, "this == b.b2");
    query.declareVariables("B b");
    query.declareImports("x.x.B");
    query.setResultClass(C.class);
    query.setResult("this as a, sum(b.b3) as s, sum(b.b1) as t");
    query.setGrouping("a");
    Collection c = query.execute();
    With this, I force to put primary key into subquery, and disables
    DISTINCT, but I never will use this field :(. SQL generated by KODO:
    SELECT s.A1, SUM(s.C) AS c, SUM(s.T) as t
    FROM ( SELECT DISTINCT a.A1 AS A1, s.B3 AS C, s.B1 as T
    FROM PUBLIC.A a INNER JOIN PUBLIC.B b ON (a.A1 = b.B2) ) s
    GROUP BY s.A1
    Questions:
    1.- What may I doing wrong?
    2.- How can I disable Distinct from subquerys?
    And, no, I don't want to select by class B and then search A objects.
    I want a C object with A object plus SUM of values from B.
    I am achieving this with this patch.
    I know that when there aren't B objects I don't receive results.
    Is there any way to build an OUTER JOIN with JDOQL ?
    In order to bypass this, I execute the query another time but reseting to
    0, but I will prefer to be able to build an OUTER JOIN ;)
    PD: Little class descriptions:
    class A{ int a1, int a2, int a3} (autogenerated by kodo)
    class B{ int b1, int b2, double b3} (autogenerated by kodo)
    class C{ A a, double c, int t} (generated by me)
    Sorry for my english :(
    thanks.

    I'll address your outer join question first, since it's the easiest. Kodo will
    create outer joins automatically as needed to satisfy your JDOQL. In this case,
    your JDOQL does not warrant an outer join. Your filter criteria on the query is
    "this == b.b2". That means the query cannot and should not return any values
    when there are no A's that match that join. Why not try this equivalent but
    simpler query?
    Query q = pm.newQuery (B.class);
    q.setResult ("b2 as a, sum(b3) as s");
    q.setGrouping ("b2");
    q.setResultClass (C.class);
    That will return results grouped by the A objects from the b2 field, and the sum
    of the b3 field for all B's in each group. It should use an outer join.
    About DISTINCT:
    The pattern of a distinct subselect is caused by two conditions:
    1. Your result clause is non-distinct. That is, you did:
    q.setResult("this as a, sum(b3) as s")
    rather than:
    q.setResult("distinct this as a, sum(b3) as s")
    This means that you want to allow duplicates in the projected values you get back.
    2. You use an unbound variable ("b") in a way that could lead to duplicates
    caused by relational joins. JDO always eliminates duplicates caused by database
    joins.
    So in order to eliminate the possible duplicates caused by #2, Kodo issues the
    query as a DISTINCT subselect. Then in order to allow duplicates of the
    projected results (#1), Kodo uses a non-distinct outer select.
    The simplest way to eliminate the DISTINCT subselect is to use the alternate
    query on B.class I mentioned above. That will result in no DISTINCTs at all.
    Another way is to use the "distinct" keyword in your setResult() call, as I
    showed in #1. That will result in a DISTINCT select without any subselect.
    Without reverting to a SQL query (which you can still execute through JDO APIs,
    as described in the documentation), I believe those are the options available.

  • How to add two columns in OBIEE report?

    Hi to All,
    Can anyone tell me how to add two columns in OBIEE report and get that result in a new column?
    Thanks in Advance,
    Thenmozhi

    Assume you already have two columns SalesAmt1 and SalesAmt2, and you want to derive 3rd column say SalesAmt3 which would be the sum of SalesAmt1 and SalesAmt2.
    For this, as I mentioned above pull SalesAmt1 and SalesAmt2 columns in Report. Now pull another column (say SalesAmt1) and open the fx. Clear the contents of fx. Now locate the columns button in the bottom of the fx. From Here, first select SalesAmt1 and + sign and the select SalesAmt2.
    Now in this new column, the fx should look like SalesAmt1 + SalesAmt2.
    Let me know if you are looking for something else.
    Thanks

  • How do I select multiple items?

    Happy New Year.  I am a new Mac user.  Recently switched from Windows.  How do I select multiple rows?  In windows you can CONTROL+click to select multiple items 1 at a time and SHIFT+click to select multiple items in groups.  I figured out to do COMMAND+click on Mac to select multiples 1 at a time.  I need to delete ALOT of rows.  How do I select multiples in groups? 
    Thanks.

    KarenSelena and BobHarris have given you the direct sequences.
    You can also select multiple disjoint ranges with combinations of ⌘ (command key) click and ⇑ (shift key) click, too.
    As you use OS X, you'll find a large number of ⌘ and ⇑ and ˄ (control key) and ⌥ (option key) clicks and shortcuts available (and some were mentioned earlier), and shortcuts such as ⌘ A (select all), ⌘ Z (undo) and a whole host of other shortcuts available.
    Here is Apple's Mac 101 / Mac Basics site, which has a good (and free) introduction toward learning to use your Mac.

  • How do I select rows from the same table that have multiple occurances

    Hi Everybody,
    I am trying to select records from a detail table by grouping it. The table has more than 1 million records and the query is not performing well. The basic question is how to select a distinct record from a table which matches all values in one column and any in the other.
    desc SCV
    ID NUMBER PK (ID + SCRID)
    SCRID NUMBER FK(SC)
    ID SCRID
    1 1
    2 1
    3 1
    4 2
    5 2
    6 3
    7 4
    8 4
    desc PROJECTS
    ID NUMBER PK
    NAME VARCHAR2(100)
    ID NAME
    1 PROJECT1
    2 PROJECT2
    3 PROJECT3
    4 PROJECT4
    desc PJS
    ID NUMBER
    PROID NUMBER FK (PROJECTS)
    SCRID NUMBER FK (SCV(SCRID + SCVID)
    SCVID NUMBER
    ID PROID SCRID SCVID
    1 1 1 1
    2 1 1 2
    3 1 2 5
    4 1 3 6
    5 1 4 7
    6 2 1 3
    7 2 2 4
    8 2 2 5
    9 2 4 7
    There are over 1 million records in PJS.
    desc TBP
    SCRID NUMBER
    SCVID NUMBER
    SCRID SCVID
    1 1
    1 2
    1 3
    2 4
    2 5
    3 6
    4 7
    4 8
    The requirement is to select projects that have matching SCRID, SCVID from TBP such that
    all distinct SCRID should match and within that and any SCVID match will do. (A "AND" between each SCRID and an "OR" for each SCVID in that SCRID like 'SCRID = 1 AND (SCVID = 1 OR SCVID = 2 OR SCVID = 3) AND SCRID = 2 AND (SCVID =....)
    So, for the sample data it should return us PROID = 1
    I have few queries written for this:
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 1
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 2
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 3
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 4
    This query performs well but the cost is very high, hardcoding, sorting.
    The 2nd option is to:
    SELECT pjs.PROID proid
    FROM TBP tbp,
    PJS pjs
    WHERE pjs.SCVID = tbp.SCVID
    AND pjs.SCRID = tbp.SCRID
    GROUP BY pjs.PROID
    HAVING COUNT(DISTINCT pjs.SCRID) = (SELECT COUNT(DISTINCT SCRID ) FROM TBP)
    This has a low cost but runs slowly.
    One more way I tried was with the IN operator like
    SELECT DISTINCT PROID FROM PJS A,TBP T WHERE T.SCRID = 1 AND T.SCVID = A.SCVID
    AND PROID IN (SELECT PROID FROM PJS A,TBP T WHERE T.SCRID = 2 AND T.SCVID = A.SCVID
    AND PROID IN (...SO ON with each DISTINCT SCRID.
    Again this involves too much of sorting.
    Any help will be appriciated.
    Thanks in advance.

    Hi Andrew,
    Use DELETE t_itab statement inside the loop.
    I have modified your code. It is perfectly working.See bellow  -
    LOOP AT it_zmember01 INTO wa_zmember01.
    WRITE: / wa_zmember01-mnumber UNDER 'NUMBER',
    wa_zmember01-mname UNDER 'NAME',
    wa_zmember01-mdob UNDER 'DOB'.
    WRITE / '-----------------------------------------------------------------'.
    DELETE it_zmember01.               " Modified
    ENDLOOP.
    DELETE it_zmember01. statement inside the loop will delete the current row of the table.
    Regards
    Pinaki

  • Select Distinct and join in ODI

    Hi,
    I have following task to perform: I am loading metadata into Planning dimension from Oracle database. I have two tables
    1. "Sales"
    Columns: Name, Number, Value
    Sample Data:
    Product 1, 10, 200
    Product 2, 30, 100,
    Product 1, 15, 500
    2. P&R
    Columns:
    Name, Alias
    Product 1, SampleSoda1
    Product 2, SampleSoda2,
    Resource 1, CanForSoda,
    Resource 2, CO2
    What I need to do is: I have to select name and alias from second table of all products that were sold.
    So I need to select distinct Name from Table 1, naxt join it with Table 2 (so I have Name and Alias) and load it to planning.
    I am a little confused how to do it.
    Any help would be great!
    Best regards,
    Greg

    Hi Greg,
    What you can do is either :
    - Create a yellow interface with your table Sales as source. Map the name column directly in the target. In the flow tab, click on your target and select "Distinct rows".
    - Create a second interface, with your first interface as source. Select the "Use Temporary Interface as Derived Table (Sub-Select)" checkbox.
    - Add your second datastore and join it. Or you can use a lookup table.
    OR
    - Create an interface with Sales and P&R as source (or set P&R as a lookup table).
    - Go on the flow tab and select "Distinct rows".
    If you've a lot a data in the first table, I would go for the first solution.
    Hope it helps.
    Regards,
    JeromeFr
    Edited by: JeromeFr on Feb 14, 2013 9:52 AM
    To be more clear in the first step of solution 1

  • Switch Section in a dashboard based on the selection of Prompts (OBIEE 10G)

    Hi All,
    I have a requirement : I have to switch Section in a dashboard based on the selection of Prompts (OBIEE 10G).
    Lets say I have 1 report in section1 and another report in section2 of a dashboard. I have a dashboard prompt,now say when the user does not select any value in a prompt I have to show section1 and when he selects values in a prompt then I have to show section2 of the dashboard. I tries this using Guided Navigation Link and presentation variable but there is a limitation that I have to select only one value in the prompt as i have created presentation variable.
    But the client wants the prompt as Multi Select. in this case I can 't use the presentation variable.
    How can I fulfil this requirement.Please let me know.
    Thanks,
    Krishna

    How you create your multiselect prompt? Is it based on a column? Using multiselect prompt you'll get an issue in this case. The prompt behavior with choosing all values and choosing nothing is equivalent. But your requirement has different behavior lines.

  • How much UNDO does a query need?

    It seems that due to a gigantic delete, I am running out of UNDO. How can I see exactly how much undo a query needs?
    Searching on the web, I found this:
    select sq.sql_text sql_text, t.USED_UREC Records, t.USED_UBLK Blocks, (t.USED_UBLK*8192/1024) KBytes from v$transaction t,
    v$session s,
    v$sql sq
    where t.addr = s.taddr
    and s.sql_id = sq.sql_id
    and s.username = 'blah'
    , which is fine, but it seems to be returning results for only running queries. In other words, when the delete query I am investigating is executed, the above select returns no rows. Is there a way to modify it to return also queries that have been executed?
    Any help is welcome.
    Message was edited by:
    user622271

    Hi,
    It seems that you need to make an outer join between v$sql and v$session views [s.sql_id = sq.sql_id(+)] ... For more information is if this [url http://forums.oracle.com/forums/thread.jspa?messageID=1756927&#1756927]thread can help you.
    Cheers
    Legatti

  • How to retain selected value in apex_item.select_list?

    Hi,
    I've a report region query-
    select distinct col1, col2,
    APEX_ITEM.HIDDEN(2,col3)||
    APEX_ITEM.SELECT_LIST(1,'No_Action','Valid;Y,Invalid;N') Action
    from <tab1>
    When 'Y' (valid) selected from the select list and SUBMIT is clicked - a validation and then page processing pl/sql process will run for the record, branching to the same page.
    If validation fails custom error message comes on screen, but value of column "Action" is reset to default 'No_Action'.
    Can anyone please tell me how can I show the last selected value in column "Action"?
    Please reply asap. Regards.

    To be able to show the last selected value you need to make the value persistent, that is update it in some column in the table.
    So the next time the report is run (refreshed) it fetches the value from the table/column . Then change your query to something like
    select distinct col1, col2,
    APEX_ITEM.HIDDEN(2,col3)||
    APEX_ITEM.SELECT_LIST(1,NVL(COL_YN,'N'),'Valid;Y,Invalid;N') Action
    from <tab1>COL_YN is the column where you stored the last selection. Unless you store it in some table/column you cannot get it back into the report when it is refreshed.
    The other way of course is to use APEX_COLLECTIONS , but that might be more complex.
    However, you need to think whether you really need the APEX_ITEMs API for this? If you just edit the Report Attributed and Edit the column definitions you might be able to achieve the same thing without having to use APEX_ITEM.
    Regards,

Maybe you are looking for