OBIEE generates complex queries

Hi,
Currently we are experiencing performance issues, i.e. some queries are running for a very long time. I examined these queries and it struck me that it could be caused by the complexity of the generated queries. For example, a query accessing only one facttable accessed that facttable 5 times (the queries are concatenated through the WITH statement) ! I wonder, why is this necessary? Business Objects XI does not generate such complex queries, BO XI would access that facttable only one time.
Basically my question is: which settings affect the queries generated by OBIEE? Isn't it possible to generate different, simpler queries?
TIA,
EriK

Thanks guys. Bad design could be a reason.. but we're using Oracle's own product called BI-APPS and I expect that to be perfect...:-)
Here is an example of a query that is imho way too complex:
WITH
SAWITH0 AS (select sum(T258218.LINE_AMT * T258218.GLOBAL1_EXCHANGE_RATE) as c1,
T551303.PROJECT_NUMBER as c2,
T258218.PURCH_ORDER_NUM as c3
from
W_PROJECT_D T551303 /* Dim_W_PROJECT_D_Project */ ,
W_PURCH_COST_F T258218 /* Fact_W_PURCH_COST_F */
where ( T258218.DELETE_FLG = 'N' and T258218.PROJECT_WID = T551303.ROW_WID and T551303.PROJECT_NUMBER = '101491' )
group by T258218.PURCH_ORDER_NUM, T551303.PROJECT_NUMBER),
SAWITH1 AS (select distinct SAWITH0.c2 as c1,
SAWITH0.c3 as c2,
SAWITH0.c1 as c3,
SAWITH0.c1 as c4,
SAWITH0.c1 as c5
from
SAWITH0),
SAWITH2 AS (select distinct SAWITH1.c1 as c1,
SAWITH1.c2 as c2,
SAWITH1.c3 as c3
from
SAWITH1),
SAWITH3 AS (select sum(T258218.LINE_AMT * T258218.GLOBAL1_EXCHANGE_RATE) as c1,
T551303.PROJECT_NUMBER as c2,
T258218.PURCH_ORDER_NUM as c3
from
W_PROJECT_D T551303 /* Dim_W_PROJECT_D_Project */ ,
W_PURCH_COST_F T258218 /* Fact_W_PURCH_COST_F */
where ( T258218.DELETE_FLG = 'N' and T258218.PROJECT_WID = T551303.ROW_WID and T551303.PROJECT_NUMBER = '101491' )
group by T258218.PURCH_ORDER_NUM, T551303.PROJECT_NUMBER),
SAWITH4 AS (select distinct SAWITH3.c2 as c1,
SAWITH3.c3 as c2,
SAWITH3.c1 as c3,
SAWITH3.c1 as c4,
SAWITH3.c1 as c5
from
SAWITH3),
SAWITH5 AS (select sum(SAWITH4.c4) as c4,
SAWITH4.c1 as c5
from
SAWITH4
group by SAWITH4.c1),
SAWITH6 AS (select sum(T258218.LINE_AMT * T258218.GLOBAL1_EXCHANGE_RATE) as c1,
T551303.PROJECT_NUMBER as c2,
T258218.PURCH_ORDER_NUM as c3
from
W_PROJECT_D T551303 /* Dim_W_PROJECT_D_Project */ ,
W_PURCH_COST_F T258218 /* Fact_W_PURCH_COST_F */
where ( T258218.DELETE_FLG = 'N' and T258218.PROJECT_WID = T551303.ROW_WID and T551303.PROJECT_NUMBER = '101491' )
group by T258218.PURCH_ORDER_NUM, T551303.PROJECT_NUMBER),
SAWITH7 AS (select distinct SAWITH6.c2 as c1,
SAWITH6.c3 as c2,
SAWITH6.c1 as c3,
SAWITH6.c1 as c4,
SAWITH6.c1 as c5
from
SAWITH6),
SAWITH8 AS (select sum(SAWITH7.c5) as c3
from
SAWITH7)
select SAWITH2.c1 as c1,
SAWITH2.c2 as c2,
SAWITH2.c3 as c3,
SAWITH5.c4 as c4,
SAWITH8.c3 as c5
from
SAWITH2,
SAWITH5,
SAWITH8
where ( nvl(SAWITH2.c1 , 'q') = nvl(SAWITH5.c5 , 'q') and nvl(SAWITH2.c1 , 'z') = nvl(SAWITH5.c5 , 'z') )
Basically the query is:
select sum(T258218.LINE_AMT * T258218.GLOBAL1_EXCHANGE_RATE) as c1,
T551303.PROJECT_NUMBER as c2,
T258218.PURCH_ORDER_NUM as c3
from
W_PROJECT_D T551303 /* Dim_W_PROJECT_D_Project */ ,
W_PURCH_COST_F T258218 /* Fact_W_PURCH_COST_F */
where ( T258218.DELETE_FLG = 'N' and T258218.PROJECT_WID = T551303.ROW_WID and T551303.PROJECT_NUMBER = '101491' )
group by T258218.PURCH_ORDER_NUM, T551303.PROJECT_NUMBER
but this query is repeated multiple times. It looks like a self join - but why is OBIEE generating such a complex query? And can it be affected?
Edited by: user10984315 on 18-Mar-2011 08:29
Edited by: user10984315 on 18-Mar-2011 08:30

Similar Messages

  • IMPLEMENTING PAGEWISE CONCEPT FOR COMPLEX QUERIES FOR WEB BASED TECHNOLOGIES

    Dear Friends
    how do i implement Page Wise concept for complex queries. Complex queries includes 'Group by', 'from selects'. Mere Rownum selection doesnt solve my problem. I have 3 buttons 'Previous', 'Next' and 'display of No. of records' . Kindly suggest me with a solution.

    The only widespread way is dynamically bild a SQL clause then parse and execute it using dynamic sql (package dbms_sql) or native dynamic sql (execute immediate clause).
    You can go through your already built cursor and display only those records you need (for example from 10th to 20th). I think there is no way to leave cursor open and reuse it another time. Every time You hit next, back or count button you need build new cursor (either selecting context columns to show some records or selecting count(*) to show number of records). You can generate this code with Oracle Designer, making webserver modules. Of course this will cost rather many $$$. Another tip - Designer makes this code for all situations and therefore it is somewhat difficult to understand it in the beginning. If you really need some example I can send something to you.

  • Complex queries in Open SQL

    Moved to performance forum by moderator
    Hi Experts,
    This is more of a discussion rather than a question. I would like to know the advantages of Open SQL. It prevents you from writing complex queries, the kind of queries that you can write in native sql.
    The biggest disadvantage I feel is that you have to fetch data into internal tables and loop. This takes a lot of processing time when you have a report having a lot of lines. A complex query using complex joins and subqueries will always perform better than having to loop and process data and simple things like generating sequence.
    The best thing about open sql is the way it handles select options.
    I would like to get your opinions and suggestions how to write complex queries in ABAP with some code snippets if possible.
    Warm Regards,
    Abdullah
    Edited by: Matt on Jan 21, 2009 6:54 PM

    > select - endselect will query the database repeatedly and wont be any different from using a loop on
    > internal table.
    that is a  very common misunderstanding, but not true, it uses the arry interface, but gives you the possibility to react on every line. But interaction with DB is in blocks.
    The biggest advantage of Open SQL is the implementation of the table buffer, every Open SQL Statement checks the buffers first.
    Other advantage, all statements changing table definitions are not allowed.
    And of course, as already said, it is a set of commands available on all DB platforms certified for SAP software, i.e. IBM, Oracle, Max DB and Microsoft.
    Complex queries, even with the available joins you can write very very complex queries ... sometimes too complex. I see not advantage for a competetion of writing the most complex statement
    Siegfried

  • Generating report queries

    We recently upgraded and we use GR55 to generate report queries used in our financial reports. We are not sure which report groups we need to regenerate and we want to avoid regenerating all of them because for sure not all of these are in use. The way for us to identify if they are in use is to check if the query is attached to a transaction code that will run the query.
    Is there a way for us to check if a report group is used with a customized transaction code?

    check this Re: how to save pdf in APEX 3.0

  • Please some one can explain about some complex queries

    BW Guru's,
    please some one can explain about some complex queries which was created while working on Reporting.
    I need to create profit and loss query as per requirment on the FL-Gl cube.
    Answer would be appreciate in advance.
    Regards
    Krish

    HI Aryan,
    No need to create FM on your own. You can copy the FM from Function Group RSAX.
    The procedure to create FM extractor is as follows:
    1) Create an extract structure.
    2) Go to SE80. Select Function Group RSAX , right click and then copy.
    3) Give your own name to the function group to copy.
    4) Select one appropriate FM from the list of FMs provided. eg FM RSAX_BIW_GET_DATA_SIMPLE.
    5)Specify the name of new FM you want to create.
    6) Go to SE37 and open the FM you have created by copying from Function Group RSAX.
    7) no need to change the import tab.
    8) On tables tab, for paramerter name E_T_DATA under asociate name specify the name of extract structure you hav created.
    9) Under source code tab make the changes in the source code only to customise it to your requirement. eg: declare the database table you are using, make changes where datasource is in picture, etc.
    I have created a generic DataSource with the help of above procedure.. I hope you will find it helpful...
    Regards,
    Geetanjali

  • REF partitioning is affecting on complex queries

    Hi,
    I am having 7 tables consider A,B,C,D,E,F,G. whereas A is master table and others are dependent on table A. columnA is referential key for all tables. Table A is having one DateRange column.
    I have successfully created range partitioning with partitioning key is DateRange. and Refeernce partitioning on other tables with column referring to ColumnA with foreign key.
    Also created local indexes on partitioned key DateRange.
    Problem is that, while fetching complex queries for reports, it is taking more time as compared to non partitioning structure. Is ref partitioning affecting on complex queries, queries returning more rows ??? Please suggest me about it.
    Thanks,
    Avinash.

    Did I miss anything ?Depends on what you've read about it sofar and why you decided to implement it.
    http://www.oracle-base.com/articles/11g/partitioning-enhancements-11gr1.php#reference_partitioning
    "The following conditions and restrictions apply to reference partitioning:
    The child table must specify a referential integrity constraint defined on the table being created. This constraint must be in ENABLE VALIDATE NOT DEFERRABLE state (the default) and refer to a primary or unique key on the parent table.
    The foreign key columns referenced in constraint must be NOT NULL.
    The constraint cannot use the ON DELETE SET NULL clause.
    The parent table referenced must be an existing partitioned table. All partitioning methods except interval partitioning are supported.
    The foreign key cannot contain any virtual columns.
    The referenced primary key or unique constraint on the parent table cannot contain any virtual columns.
    Reference partitioning cannot be used for index-organized tables, external tables, or domain index storage tables.
    A chain of reference partitioned tables can be created, but constraint used can't be self-referencing.
    The ROW MOVEMENT setting for both tables must match.
    Reference partitioning cannot be specified in a CREATE TABLE ... AS SELECT statement."

  • Differentiate between Simple, Medium and Complex Queries.

    Hi Gurus,
    I am a Tech. Architect on this new project. I would like to know how to differentiate between Simple, Medium and Complex Queries in BW because I need this info to work on the Estimates. Has this differentiation got anything to do with the Backend config also?
    Thanks in Advance.
    Chandu.

    Hi
    You need to understand the requirements and consider the following before you classify........
    1) Queries that are based on multiple key figures--which may result in cell definition.
    2) Queries with complex calculations.
    3) Queries that are based on Variable Exits
    Regards
    Srinivas Bandi

  • Documenting complex queries

    I'd like to start providing better documentation along with the database objects I produce. What's the best way to document what's going on in complex queries? I've started trying out different techniques of documenting source/target in a spreadsheet, but it seems to be lacking. I was wondering what others do? Any suggestions or references you could point me to? I could probably improve upon my inline comment practices, so any suggestions there are also welcome. Thanks

    I’ve encountered the problem before and got some good advice here: Re: Documentation help:  Procedural logic Vs Set logic
    Because SQL is an explicit language, and programmers being in the mental state that they are when programming, it’s difficult for us to deconstruct our perfectly explicit, self-documenting SQL statement into something that someone else will understand.
    The diagram linked in the above forum thread is an example where to explain what I’m doing, I’ve had to change the set-based logic of the SQL statement into a procedural loop type explanation. I hated doing this, but it was the best way I could think of to explain it to someone.
    More recently I’ve had to document a query that is fairly simple logically (to me anyway) but due to the number of tables and the fact that the audience doesn’t necessarily understand spatial queries, I found it easier to break it down using the following diagram:
    http://img.photobucket.com/albums/v115/whitehat/work%20related/query1.jpg
    tables probably won’t mean anything to you, but you can see how I’ve broken it down into business-logic “Retrieve criteria for exception checking”, “select providers”, “restrict providers” etc. the arrows represent the join criteria and the boxes split up the driving tables and the restriction tables.
    I’ve found this particular diagram very useful as part of the current project that I’m involved with. Even the System Testers are relying on this diagram to direct them in how everything fits together.
    Each situation is different however and you’ll just have to experiment with each bit of code as it comes along.
    Hope this helps!

  • Want complex queries

    Hi,
    Where can i find the SQL queries(unsolved) through which i can learn to write complex queries...
    As I am a novice programmer it would be better if the range varies from easy to complex ones.
    Thanks in advance.
    Mythili

    Actually for me a skill full SQL developer is one who can solve a complex problem with a simple SQL. Not the one who can write complex SQL ;)
    Some of the places from where i learn new and exiting stuff ever day are
    [Asktom.oracl.com |http://asktom.oracle.com/pls/asktom/f?p=100:1:146758316283624]
    [forums.oracle.com|http://forums.oracle.com/forums/main.jspa?categoryID=84]
    [Richard footes oracle blog|http://richardfoote.wordpress.com/]
    [Oracle Document is always there|http://tahiti.oracle.com/]
    These places are not going to make you a great SQL Developer in a day. You have to be there and keep learning constantly. Without your knowledge over a period of time your approach towards SQL will change. And change is good ;)

  • More complex queries ???

    hi all,
    Can you tell me anyone, where can I found more complex queries for oracle sql expert exam ?
    thx in advance

    Hi Christopher,
    have you checked out chapter 20 of the BPEL developers guide, at otn.oracle.com/bpel?
    It covers the dbadapter. Also we have many samples with the install, check out samples/tutorials/122.DBAdapter/PureSQLSelect.
    The most advanced solution, if you know TopLink well enough, is to use descriptor ammendment to express any complex sql using TopLink's proprietary expression API. Your ammendment class is written in java and must be on the appserver's classpath. You could check out the toplink otn forum for more info about that.
    Thanks
    Steve

  • Complex Queries.

    Hi Gang,
    I was in an interview last week and was asked to give an example of a complex queries I have worked with. I was really cought off guard and could not give a very intelligent answer other than mumbling. Can someone please help me out with real life examples? May be I will be asked the same in my next interview.
    Thanks,
    Kara.

    There are many features available in BEx querying, I would think that being able to discuss how / why you used some of them in the same query is what they are looking for, e.g. 
    - Creating RKFs with restrictions on several characteristics
    - Using variable offsetsto get KFs form different time periods
    - A case where using Constant Selection was needed.
    - Using some of the various totaling options.
    - Use of MultiProvider that includes Cube, ODS, and Master Data.
    Now if you haven't actually designed any quereis, this can be a challenge........

  • Complex Queries Developed in Desktop for Plus Users

    I develop complex queries in Discoverer desktop, with complex calculations and conditions and customized report formats. I understand that my "Plus" users can run them all. Is that correct?
    What about my "Viewer" users?

    Hi,
    The "Viewers" users can run any complex report, equally like "Plus". The reports would have to be shared with the Viewers users.
    Discoverer desktop is a client side development tool and Plus is the "Equivalent" web version. So complex calculations/conditions should not affect.
    Thanks.

  • Problem with OBIEE generated query

    Hi All,
    I'm working on OBIEE 10.1.3.4 version. For generating one report am using five tables , in thses five tables 2 are the fact tables and remaining all are dimensional tables.
    In these five tables am using one or more colums in each table and we joined properly for these five tables(we are not getting any error on these joins). The problem is when ever i get query from OBIEE (Administration--->Manage sessions) its not generating a single query , instead of single query its splits into more queries..
    Why its not generating the single query ,we are assuming that beacause of these reports are taking time to show the results.
    Could you pls suggest me why i'm facing these and also i have these problem for only one report for remainig reports OBIEE is generating sine query.

    Hi,
    Please refer : multiple queries for single report
    Why multiple queries ?
    when we can find the multiple queries in view logn
    Thanks,
    Saichand.v

  • OBIEE generated SQL differs if it's a Physical Table or Select Table...

    Hi!
    I have some tables defined in the Physical Layer, which some are Physical Tables and others are OBIEE "views" (tables created with a Select clause).
    My problem is that the difference in the generated SQL for the same table, differs (as expected) whether it is a Physical Table or a "Select Table". And this difference originates problems in the returned data. When it a Physical Table, the final report returns the correct data, but when it is a Select Table it returns incorrect/incomplete data. The report joins this table with another table from a different Database (it is a join between Sybase IQ and SQL Server).
    This is the generated SQL in the log:
    -- Physical Table generated SQL
    select T182880."sbl_cust_acct_row_id" as c1,
    T182880."sbl_cust_acct_ext_key" as c2,
    T182880."sbl_cust_source_sys" as c3
    from
    "SGC_X_KEY_ACCOUNT" T182880
    order by c2, c3
    -- "Select Table" generated SQL
    select
         sbl_cust_acct_ext_key,
         ltrim(rtrim(sbl_cust_source_sys)) as sbl_cust_source_sys,
         sbl_cust_acct_row_id,
         sbl_cust_acct_camp_contact_row_id,
         ods_date,
         ods_batch_no,
         ods_timestamp
    from dbo.SGC_X_KEY_ACCOUNT
    As you may notice, the main difference is the use of Aliases (which I think that it has no influence in the report result) and the use of "Order By" (which I start to think that it its the main cause to return the correct data).
    Don't forget that OBIEE server is joining the data from this table, with data from another table from a differente database. Therefore, the join is made in memory (OBIEE Engine). Maybe in the OBIEE Engine the Order by is essential to guarantee a correct join...but then again, I have some other tables in the Physical Layer that are defined as "Select" and the generated SQL uses the aliases and the Order by clause...
    In order to solve my problem, I had to transform the "Select Table" into a "Physical Table". The reason it was defined as a "Select Table" was because it had a restriction in the Where Clause (which I eliminated already, althouth the performance wil be worse).
    I'm confused. Help!
    Thanks.
    FPG

    Hi FPG,
    Not sure if this is a potential issue for you at all, but I know it caused me all kinds of headaches before I figured it out. Had to do with "Features" tab Values in the database object's settings in the Physical Layer:
    Different SQL generated for physical table query vs. view object query?
    Mine had to do with SQL from View objects not being submitted as I would expect, sounds like yours has more to do with "Order By"? I believe I remembered seeing some Order By and Group By settings in the "Features" list. You might make a copy of your RPD and experiement around with setting some of those if they aren't already selected and retesting your queries with the new DB settings.
    Jeremy

  • Syntax error in OBIEE generated Physical query - Advance filter concept

    I encountered a syntax error when running a report with the help of advanced filter concept.
    I am getting syntax error at the physical query generated by the OBIEE for main report.
    I used a sub report with the help of advanced filter concept in main report.
    I am posting the physical query for the convenience.
    select D1.c2 as c1,
    D1.c1 as c2
    from
    (select sum(T600347.sales_usd) as c1,
    T601002.currency as c2
    from
    (Select distinct currency from pfact) T601002,
    pfact T600347
    where ( T600347.currency = T601002.currency and T600347.pdate between ( select distinct min(D1.c1) as c1* from
    (select D1.c1 as c1
    from
    (select D1.c1 as c1
    from
    *(select max(T600425.pdate) as c1*
    from
    *(select distinct pdate from pdates where pdate is not null) T600425*
    where  ( T600425.pdate < 11/22/2010 )
    *) D1*
    ) D1
    ) D1 ) and '11/25/2010')
    group by T601002.currency
    ) D1
    I executed the query against my database(sybase) in query tool. It showed error.
    I took out the column alias generated by the OBIEE ("as c1" as underlined). Then the query is working fine.
    How to disable OBIEE from generating the alias.
    Is there any way to do it.
    If obiee is generating the physical query, i am suprised to see a syntax error.
    The bold part is the query from Intermediate report
    I underlined the problematic part.
    Please help me. This is an urgent reuirement,
    Thanks in advance for the help.

    HI,
    When I execute the query on query tool ( my database is sybase)
    I am geting error at "as c1" part, as underlined in the query.
    when I remove that and execute the query, It is generating the output.
    here is the better view of query and error:
    http://img255.imageshack.us/img255/4719/25187227.jpg

Maybe you are looking for

  • Software bug in OneDrive for Business 1.2.2 (IOS)

    I found a software bug in OneDrive for Business 1.2.2 (iOS) and is related to the space characters inside the logon name. I am using SharePoint 2013 (15.0.4617.1000 June 2014 CU) and my setup corresponds with the OneDrive for Business App requirement

  • Insert prompt value as column in report...

    Hello, We use reports to populate the recipient list of our campaigns (the segmentation wizard does not meet our needs). The source code assigned to each campaign is as follow, 'YYYYQX', with YYYY being the year of the campaign and X being the quarte

  • Want to find out parent class of a class without using getSuperClass

    hi, I am trying to write a code to find out the base class /interfaces of a class by its object and i dont want to use getSuperClass,getInterfaces methods. Below is a snippet i tried but it does not work: public class Test extends Parent{ public void

  • Servlet and iText pdf creator

    Hi, I have seen that all examples using iText and servlets send the pdf through the browser by using: response.setContentType("application/pdf"); PdfWriter.getInstance(document, response.getOutputStream()); I would need that besides send that info, t

  • Trying to share a share a printer wirelessly with a Windows PC

    Let me start by saying, I have almost no experience using Apple computing products. So assume I know nothing. I have a printer connected to my PC at the office. A friend is going to be sharing my office and she uses an Apple iBook running OS X 10.4.6