Logical sql firing larger aggregate table instead of smaller one

Hi
When we process a request containing one particular column alone along with some time dimension say month or year, the logical sql is firing larger aggregare table instead of smaller aggregate table. Please, help us in resolving this issue.
The OracleBI version we are using is 10.1.3.4.1
Thanks.

Hi,
Try posting in the OLAP forum.
OLAP
Thanks, Mark

Similar Messages

  • Dividing large Flash Videos Movies into smaller ones that play in sequence

    I need to know how I can take a large flash movie and divide
    it into two or more smaller ones that play in sequence in order to
    speed up initial download time. I have the swfsequencer plugin but
    I do not know how to use it.
    Can anyone please help me with this?

    http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Liv eDocs_Parts&file=00002980.html

  • Simultaneous hash joins of the same large table with many small ones?

    Hello
    I've got a typical data warehousing scenario where a HUGE_FACT table is to be joined with numerous very small lookup/dimension tables for data enrichment. Joins with these small lookup tables are mutually independent, which means that the result of any of these joins is not needed to perform another join.
    So this is a typical scenario for a hash join: the lookup table is converted into a hashed map in RAM memory, fits there without drama cause it's small and a single pass over the HUGE_FACT suffices to get the results.
    Problem is, so far as I can see it in the query plan, these hash joins are not executed simultaneously but one after another, which renders Oracle to do the full scan of the HUGE_FACT (or any intermediary enriched form of it) as many times as there are joins.
    Questions:
    - is my interpretation correct that the mentioned joins are sequential, not simultaneous?
    - if this is the case, is there any possibility to force Oracle to perform these joins simultaneously (building more than one hashed map in memory and doing the single pass over the HUGE_FACT while looking up in all of these hashed maps for matches)? If so, how to do it?
    Please note that the parallel execution of a single join at a time is not the matter of the question.
    Database version is 10.2.
    Thank you very much in advance for any response.

    user13176880 wrote:
    Questions:
    - is my interpretation correct that the mentioned joins are sequential, not simultaneous?Correct. But why do you think this is an issue? Because of this:
    which renders Oracle to do the full scan of the HUGE_FACT (or any intermediary enriched form of it) as many times as there are joins.That is (should not be) true. Oracle does one pass of the big table, and then sequentually joins to each of the hashmaps (of each of the smaller tables).
    If you show us the execution plan, we can be sure of this.
    - if this is the case, is there any possibility to force Oracle to perform these joins simultaneously (building more than one hashed map in memory and doing the single pass over the HUGE_FACT while looking up in all of these hashed maps for matches)? If so, how to do it?Yes there is. But again you should not need to resort to such a solution. What you can do is use subquery factoring (WITH clause) in conjunction with the MATERIALIZE hint to first construct the cartesian join of all of the smaller (dimension) tables. And then join the big table to that.

  • Errors when Creating Aggregate Tables in OBIEE 11.1.1.6 within SQL server

    Hi All,
    I was trying to create an aggregate table in OBIEE 11.1.1.6 within SQL Server. The sql was generated successfully as below. But an error occurred when I use NQCMD to execute the sql and the following error showed:
    1. SQL for creating Aggregate Table:
    create aggregates
    "ag_Measure"
    for "ASOBI_DTT_Demo"."Measure"("ValidVIPCnt")
    at levels ("ASOBI_DTT_Demo"."日期"."月", "ASOBI_DTT_Demo"."門市品牌"."門市品牌", "ASOBI_DTT_Demo"."門市類別"."門市類別", "ASOBI_DTT_Demo"."內創門市"."內創門市", "ASOBI_DTT_Demo"."門市/倉庫"."門市/倉庫", "ASOBI_DTT_Demo"."門市群組"."門市群組", "ASOBI_DTT_Demo"."門市行政區課"."行政區", "ASOBI_DTT_Demo"."門市地區"."城市")
    using connection pool "ASOBI_DTT_Demo"."ASOBI_System10"
    in "ASOBI_DTT_Demo"."ASOBI"."dbo";
    2. Error Message:
    "ag_Measure"
    for "ASOBI_DTT_Demo"."Measure"("ValidVIPCnt")
    at levels ("ASOBI_DTT_Demo"."日期"."月", "ASOBI_DTT_Demo"."門市品牌"."門市品牌"
    , "ASOBI_DTT_Demo"."門市類別"."門市類別", "ASOBI_DTT_Demo"."內創門市"."內創門市"
    , "ASOBI_DTT_Demo"."門市/倉庫"."門市/倉庫", "ASOBI_DTT_Demo"."門市群組"."門市群
    組", "ASOBI_DTT_Demo"."門市行政區課"."行政區", "ASOBI_DTT_Demo"."門市地區"."城市
    using connection pool "ASOBI_DTT_Demo"."ASOBI_System10"
    in "ASOBI_DTT_Demo"."ASOBI"."dbo"
    [343][State: 37000] [Microsoft][SQL Server Native Client 10.0][SQL Server]CREATE
    、DROP or ALTER 陳述式中使用未知的物件類型 'aggregates'。
    Statement execute failed
    Which means "Using unknown object type 'aggregates' in CREATE. DROP or ALTER statements" in English.
    Can anyone give me a suggestion for this error?? Many thanks!!!

    Hi Martin,
    I guess, I was not clear enough. Let me try again
    How Aggregate Persistence works in OBIEE?
    Once you are done choosing options in the Aggregate Persistence wizard, it generates an intelligent Query.
    What query is it?
    If you happen to understand the query, it is not like any ANSI standard SQL (I would say DDL) query. As you might have noticed there are no SQL Server datatypes, lengths, keys, constraints etc. This query can only be understood by the BI Server.
    How do I issue this query?
    Since the logical query could only be understood by BI Server, it has to be issued only to BI Server Engine using some tool viz NQCMD in this case.
    What does issuing this query using NQCMD do?
    The execution steps are as follows, the moment the query is issue via NQCMD
    Aggregate Persistent Wiz Generate Query ----- Issued to ---> NQCMD ----- Passes the logical query to ---> BI Server ----- Parses the query ---> Builds the corresponding physical DDL statements Issued --->To the Database --- If successful ---> .RPD is automatically updated with the aggregated sources etc.
    How do I pass the query to BI Server using NQCMD?
    The format of issuing this logical query to BI Server using NQCMD is
    nqcmd -d <Data Source Name> -u <Analytics UserId> -p <Password> -s <command> > output.log
    where
    <Data Source Name> : Is the DSN name which OBIPS uses to talk to Oracle BI Server. Yes, it's the very same DSN that can be found in InstanceConfig.xml
    <Analytics UserID> : Any user in obiee with admin privileges.
    <Password> : Password of the obiee UserId
    <Command> : Logical SQL Command which you already have handy.
    Hope I was good this time..
    Dhar

  • Filter not applied in answers because of aggregate tables

    Hi Gurus:
    I am having an issue with filters and aggregate tables.
    I have a report which I am filtering on a dimension.
    Now, if I dont expose that column on report, it is not filtering properly. It is hitting aggregate tables and hence result is not correct.
    I checked physical SQL issued, and it doesn't even have that filter in WHERE clause. However, logical SQL has it.
    However, if I expose that column on report table, then it is filtering properly, since it is hitting base tables.
    I cannot include this column in aggregated dimension , since it is not part of hierarchy ( Snow flaked ).
    Any idea why is this happening?
    Please help me.
    - Vinay

    Hi Vinay,
    The hints I gave you are not work-arounds or band-aids to OBIEE. They are the features in OBIEE meant for a specific purpose.
    As far as the Best Practice OBIEE is meant strictly to source a Fully Qualified Data Marts. You cannot expect a high level summarized data within a few seconds from OBIEE, if you dont have data rolled-up and summarized to different levels.
    When we first started using this tool replacing Actuate a couple of years ago, we thought our users will be happy seeing the reports on a click. But it was horrible than Actuate because we dont have our data rolled-up or aggregated.
    Now our users love the reports because we have highly aggreagated data sources such as Essbase, Materialized Views, Query Re-Writes, Indexes, Partitioning etc.... etc... and these are all out side OBIEE.
    Thanks
    Sai

  • OBIEE bypasses smaller aggregate table and queries largest aggregate table

    Hello,
    Currently we are experiencing something strange regarding queries that are generated.
    Scenario:
    We have 1 detail table and 3 aggregate tables in the RPD. For this scenario I will only refer to 2 of the Aggregates.
    Aggregate 1 (1 million rows):
    Contains data - Division, Sales Rep, Month, Sales
    Aggregate 2 (13 milliion rows):
    Contains data - Division, Product, Month, Sales
    Both tables are set at the appropriate dimension levels in the Business Model. Row counts have been updated in the physical layer in the RPD.
    When we create an answers query that contains Division, Month and Sales, one would think that OBIEE would query the smaller and faster of the two tables. However, obiee wants to query the table with 13 million records completely bypassing the smaller table. If we make the larger aggregate inactive, then OBIEE queries the smaller table. We can't figure out why OBIEE wants to immediately go to the larger table.
    Has anyone experienced something such as this? Any help would be greatly appreciated.
    Edited by: gwb on Aug 19, 2009 7:45 AM

    Have you try to change the sort order of the logical table source in your logical table ?
    !http://gerardnico.com/wiki/_media/temp/obiee_logical_table_sources_sort.jpg!
    Set the Aggregate 1 first.
    Cheers
    Nico

  • Re : When to Use tables instead of Cursors in Stores Procedures

    Hello All,
    Hope all is well. I know this is very broad questions and requires more specifics. All, I am trying to understand from very high level is to what are some of the instances when one would prefer to have physical/temp tables instead of using cursors in SP. Generic Pointers would really be helpful.
    Thanks in advance,
    Sam

    You are comparing apples and oranges here.
    A cursor is a work area where oracle stores the procession information when it executes a multi-row query.
    Lets say you have a sql query like this
    select * from empWhen such a query is executed oracle allocates a work area where the processing information of the query is stored. This
    is called a cursor. You can explicitly define a cursor like this.
    cursor c_emp
    is
    select * from empIn this case you are giving a name to the work area allocated by oracle. Now you can use this name c_emp to access the
    result set sequentially.
    On the other hand a Table is an oracle Object. It is a logical representation of your physical data.
    Data in a table can be manipulated meaning, you can insert, update or delete it. Data in a table is persistent.
    So i don't think a comparison between this two is appropriate.
    Thanks,
    Karthick.

  • How to ignore special characters in Logical SQL.

    Hi Experts,
    I am using Logical SQL generated from BI Answers in dataset of BIP Data model.
    The column name or presentation table name contains special character as “&, %’
    So when I try to create dataset using suppose following Logical SQL, I am getting prompt/error as
    “Please enter values for lexical references in SQL
    *~ description"."security name" s_9, ”
    Could you please suggest what should I do to ignore these special characters?
    SELECT
    0 s_0,
    "TEST_RPD"."Account"."As Of Date" s_1,
    "TEST_RPD"."Security Identifier & Description"."Security Name" s_9,
    "TEST_RPD"."Statistics"."Quality - S&P Rating" s_26,
    "TEST_RPD"."Statistics"."Yield To Maturity" s_27
    FROM "TEST_RPD"
    WHERE
    (("Account"."As Of Date" = date '2011-01-31') AND ("Account"."Report Account ID" = '1733'))

    Thanks..That is what we did in RPD.
    I was looking for any other approach as our RPD is shared between OBIEE and BIP.

  • Java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist while invoking a DBAdapter

    I have a WebService which is invoked , the request is routed through the mideator to the DBAdapter .DBAdapter interacts with the database and replies the result.
    I send in the CreditCardNumber in the request and recieve its Status (VALID,INVALID). i get this error every time . i have tried almost every thing to fix this . Please help me with same .
    Below is the complete error stacktrace.
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'getCreditValidationSelect' failed due to: DBReadInteractionSpec Execute Failed Exception. Query name: [getCreditValidationSelect], Descriptor name: [getCreditValidation.Creditcardinfo]. Caused by java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist . See root exception for the specific exception. This exception is considered retriable, likely due to a communication failure. To classify it as non-retriable instead add property nonRetriableErrorCodes with value "942" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    Thanks in advance

    Can you please check the following
    a. check the JNDI Configuration. ( check for the value used for XADatasourceName )
    b. check the Data source created for the User.
    c. Incase you have updated the existing JNDI then you need to update the adapter with the New Deployment Plan.
    Thanks,
    Sunil Gopal

  • Error when creating aggregate table

    Hello,
    I am creating an aggregate table using the Aggregate Persistence Wizard. When trying to run the batch file, I am receiving an error: "Could not connect to the Oracle BI Server instance".
    But then, the Oracle BI Server is running and I am able to do queries in answers with no connection issues. (Pls see below)
    Please help.
    Thanks,
    Felicity
    D:\OracleBI\server\Repository>create_agg.bat
    D:\OracleBI\server\Repository>nqcmd -d AnalyticsWeb -u Administrator -p Administ
    rator -s D:\OracleBI\server\Repository\CREATE_AGG.sql
    Oracle BI Server
    Copyright (c) 1997-2009 Oracle Corporation, All rights reserved
    create aggregates
    "ag_SalesFacts"
    for "SupplierSales"."SalesFacts"("Net Weight Shipped","Units Ordered","Units Sh
    ipped","Dollars")
    at levels ("SupplierSales"."ProductsDim"."Type", "SupplierSales"."CustomersDim"
    ."SalesRep", "SupplierSales"."PeriodsDim"."Month")
    using connection pool "ORCL"."SUPPLIER CP"
    in "ORCL".."SUPPLIER2"
    create aggregates
    "ag_SalesFacts"
    for "SupplierSales"."SalesFacts"("Net Weight Shipped","Units Ordered","Units Sh
    ipped","Dollars")
    at levels ("SupplierSales"."ProductsDim"."Type", "SupplierSales"."CustomersDim"
    ."SalesRep", "SupplierSales"."PeriodsDim"."Month")
    using connection pool "ORCL"."SUPPLIER CP"
    in "ORCL".."SUPPLIER2"
    [10058][State: S1000] [NQODBC] [SQL_STATE: S1000] [nQSError: 10058] A general er
    ror has occurred.
    [nQSError: 37001] Could not connect to the Oracle BI Server instance.
    Statement preparation failed
    Processed: 1 queries
    Encountered 1 errors

    Will this help you solve issue http://forums.oracle.com/forums/thread.jspa?messageID=3661598
    Check the comments in this blog http://obiee101.blogspot.com/2008/11/obiee-aggregate-persistence-wizard.html
    It deals with use permissions for the database.
    hope answers your question..
    Cheers,
    kk

  • OBIEE:  logical SQL to Physical sql conversion

    Hi,
    Is there any way i can get the physical sql from logical sql ( Apart from reading log file).. I am looking something like JAVA api which does that for us.. Do we have any mapping table which stores this mapping.
    Does the OBIEE provides any Java API.
    Appreciate your help in advance.

    Hi Experts,
    Please help on this.

  • Converting logical SQL to physical

    I have a bunch of logical queries stored in my usage tracking table. What's the easiest way that I can convert these to physical SQL? I want to avoid re-running the reports and looking at the NQQuery.log.
    Let me know if there's an easy way to run my logical sql and getting the physical query from it.

    Hi,
    i) Dashboard -> Click Settings > Administration to open the Oracle BI Presentation Services Administration Window
    ii) Click the Manage Sessions link to open the Session Management window.
    iii)In the Session Management window, under Cursor Cache, click the View Log link for the last entry.
    The log displays the last query.
    iv)Locate :
    the SQL Request section. This section contains the logical SQL issued from Answers.
    the General Query Info section, just below the SQL Request section. This section identifies the repository, subject area, and presentation catalog from which the query was run.
    the Sending query to database named SH section, just below the General Query Info section. This section identifies the physical data source to which Oracle BI Server is connecting and the physical sql that was generated.
    Cheers,
    Aravind

  • Has anyone managed to configure aggregate tables correctly?

    Hi all,
    Although OBIEE supports the use of aggregate tables in fact tables as an additional source (for performance improvements), has anyone actually correctly configured them for metrics that use AVGs?
    We are seeing that if you create an aggregate table which already calculates averages, when these values are used in further aggregations at the higher levels, they are actually incorrect, as they are based on the pre-calculated averages of the aggregate table, and not on the average of the lowest grain of detail of the fact. This is not a problem for SUM, MIN or MAX metrics, but is a problem for AVG metrics.
    This is partly logical, but is a serious limitation for the use of aggregate tables. These tables are correct for all the dimensions included in that aggregated table, but not when you remove one of those dimension in an OBIEE request.
    The only workaround we see is to redefine the metric as a metric with a logical definition:
    SUM(column that contains value which we want an average for) / SUM (no. of columns in question)
    At the lowest detail this has no impact, but on the aggregated levels above, this would assure a correctly calculated average.
    Any advice? Opinions? Prior experiences? anything?

    Thanks Wildnight.
    Yes, it seems logical that with sum all would work correctly, however i think this is only one type of common metrics in use in any datawarehouse. If anyone has any other ideas let me know.
    There is also the possibility to play around with the aggregate configuration based on dimensiones (maybe introducing some clever formula in the 'Others' dimension option), or maybe defining AVG in the actual metric definition in the column mappings, and setting the aggregate rule to None.

  • How to manage large partitioned table

    Dear all,
    we have a large partitioned table with 126 columns and 380G not indexed can any one tell me how to manage it because now the queries are taking more that 5 days
    looking forward for your reply
    thank you

    Hi,
    You can store partitioned tables in separate tablespaces. This does the following:
    Reduce the possibility of data corruption in multiple partitions
    Back up and recover each partition independently
    Control the mapping of partitions to disk drives (important for balancing I/O load)
    Improve manageability, availability, and performance
    Remeber as the doc states :
    The maximum number of partitions or subpartitions that a table may have is 1024K-1.
    Lastly you can use SQL*Loader and the import and export utilities to load or unload data stored in partitioned tables. These utilities are all partition and subpartition aware.
    Document Reference:
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14231/partiti.htm
    Adith

  • Multiple Aggregate Tables in OBIEE

    We are experiencing a funky issue with the use of aggregate tables. Unfortunately, I am not seeing any obvious way in the documentation or blogs to remedy this issue.
    Leveraging the Aggregate Persistance Wizard we developed 2 aggregates for our data set.
    1st is a monthly aggregate with a rollup data set and the 2nd is the daily aggregate with a more limited data set.
    For a set of monthly queries and dashboards both aggregates will produce the correct results, but the monthly agg does it 10 times faster <5 sec. However, for some reason the BI Server is choosing the daily aggregate instead.
    Any ideas on how we can force / hint for the BI server to use the monthly aggregate first if it can?Thanks,
    Michael

    The log, unfortunately, is to big to in its entirety, but here is the example of the queries that go against the daily aggregate as oppose to the monthly:
    +++Administrator:7a0000:7a0001:----2009/06/10 09:04:48
    -------------------- General Query Info:
    Repository: Star, Subject Area: EnterpriseBI, Presentation: EVSalesReporting
    +++Administrator:7a0000:7a0001:----2009/06/10 09:05:14
    -------------------- Sending query to database named BONARDEV (id: <<6974073>>):
    select D3.c4 as c1,
    D3.c5 as c2,
    D3.c2 as c3,
    D3.c1 as c4,
    D3.c6 as c5,
    D3.c7 as c6,
    D3.c8 as c7,
    D3.c3 as c8
    from
    (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8
    from
    (select sum(T31738.Curr_Day00015AE1) as c1,
    D47.c8 as c2,
    D47.c4 as c3,
    T31723.Trade_Clas0001777C as c4,
    D47.c3 as c5,
    D47.c7 as c6,
    D47.c6 as c7,
    D47.c5 as c8,
    ROW_NUMBER() OVER (PARTITION BY T31723.Trade_Clas0001777C, D47.c4 ORDER BY T31723.Trade_Clas0001777C ASC, D47.c4 ASC) as c9
    from
    SA_Trade_C000176D4 T31723,
    SA_Organiz00015413 T31635,
    ag_Sales_Metrics_2 T31738,
    (select distinct D1.c1 + 1 as c1,
    D1.c2 as c2,
    D1.c3 as c3
    from
    (select min(D1.c1) over (partition by D1.c4) as c1,
    min(D1.c2) over (partition by D1.c4, D1.c3) as c2,
    D1.c3 as c3
    from
    (select Case when case D1.c5 when 1 then D1.c3 else NULL end is not null then Rank() OVER ( ORDER BY case D1.c5 when 1 then D1.c3 else NULL end ASC NULLS LAST ) end as c1,
    Case when case D1.c6 when 1 then D1.c3 else NULL end is not null then Rank() OVER ( PARTITION BY D1.c4 ORDER BY case D1.c6 when 1 then D1.c3 else NULL end ASC NULLS LAST ) end as c2,
    D1.c3 as c3,
    D1.c4 as c4
    from
    (select T31704.Date_ID00016FBC as c3,
    T31704.Calendar_Y00014B57 as c4,
    ROW_NUMBER() OVER (PARTITION BY T31704.Calendar_Y00014B57 ORDER BY T31704.Calendar_Y00014B57 DESC) as c5,
    ROW_NUMBER() OVER (PARTITION BY T31704.Calendar_Y00014B57, T31704.Date_ID00016FBC ORDER BY T31704.Calendar_Y00014B57 DESC, T31704.Date_ID00016FBC DESC) as c6
    from
    SA_Day00015E8E T31704
    ) D1
    ) D1
    ) D1
    ) D48,
    (select distinct min(D1.c1) over (partition by D1.c6) as c1,
    min(D1.c2) over (partition by D1.c6, D1.c4) as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8
    from
    (select Case when case D1.c9 when 1 then D1.c4 else NULL end is not null then Rank() OVER ( ORDER BY case D1.c9 when 1 then D1.c4 else NULL end ASC NULLS LAST ) end as c1,
    Case when case D1.c10 when 1 then D1.c4 else NULL end is not null then Rank() OVER ( PARTITION BY D1.c6 ORDER BY case D1.c10 when 1 then D1.c4 else NULL end ASC NULLS LAST ) end as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8
    from
    (select T31704.Calendar_M00014B4D as c3,
    T31704.Date_ID00016FBC as c4,
    T31704.Calendar_Q00014B51 as c5,
    T31704.Calendar_Y00014B57 as c6,
    T31704.Month_End_00014B6D as c7,
    T31704.Calendar_D00014B5B as c8,
    ROW_NUMBER() OVER (PARTITION BY T31704.Calendar_Y00014B57 ORDER BY T31704.Calendar_Y00014B57 DESC) as c9,
    ROW_NUMBER() OVER (PARTITION BY T31704.Calendar_Y00014B57, T31704.Date_ID00016FBC ORDER BY T31704.Calendar_Y00014B57 DESC, T31704.Date_ID00016FBC DESC) as c10
    from
    SA_Day00015E8E T31704
    ) D1
    ) D1
    ) D47
    where ( T31635.Organizati00014BB3 = T31738.Organizati00014BB3 and T31723.Trade_Clas0001777D = T31738.Trade_Clas0001777D and T31635.Business_U00014BC5 = 'EVD' and T31738.Date_ID00016FBC = D48.c3 and D47.c1 = D48.c1 and D47.c3 = '2009 / 05' and (T31723.Trade_Clas0001777C in ('Redemption', 'Sale')) and D47.c2 >= D48.c2 )
    group by T31723.Trade_Clas0001777C, D47.c3, D47.c4, D47.c5, D47.c6, D47.c7, D47.c8
    ) D1
    where ( D1.c9 = 1 )
    ) D3
    order by c8, c2, c1
    +++Administrator:7a0000:7a0001:----2009/06/10 09:05:14
    -------------------- Sending query to database named BONARDEV (id: <<6977524>>):
    select D4.c4 as c1,
    D4.c5 as c2,
    D4.c2 as c3,
    D4.c1 as c4,
    D4.c6 as c5,
    D4.c7 as c6,
    D4.c8 as c7,
    D4.c3 as c8
    from
    (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8
    from
    (select sum(T31738.Curr_Day00015AE1) as c1,
    D49.c3 as c2,
    D49.c5 as c3,
    T31723.Trade_Clas0001777C as c4,
    D49.c4 as c5,
    D49.c7 as c6,
    D49.c8 as c7,
    D49.c6 as c8,
    ROW_NUMBER() OVER (PARTITION BY T31723.Trade_Clas0001777C, D49.c5 ORDER BY T31723.Trade_Clas0001777C ASC, D49.c5 ASC) as c9
    from
    SA_Trade_C000176D4 T31723,
    SA_Organiz00015413 T31635,
    ag_Sales_Metrics_2 T31738,
    (select distinct min(D1.c1) over (partition by D1.c4) as c1,
    min(D1.c2) over (partition by D1.c4, D1.c3) as c2,
    D1.c3 as c3
    from
    (select Case when case D1.c5 when 1 then D1.c3 else NULL end is not null then Rank() OVER ( ORDER BY case D1.c5 when 1 then D1.c3 else NULL end ASC NULLS LAST ) end as c1,
    Case when case D1.c6 when 1 then D1.c3 else NULL end is not null then Rank() OVER ( PARTITION BY D1.c4 ORDER BY case D1.c6 when 1 then D1.c3 else NULL end ASC NULLS LAST ) end as c2,
    D1.c3 as c3,
    D1.c4 as c4
    from
    (select T31704.Date_ID00016FBC as c3,
    T31704.Calendar_Y00014B57 as c4,
    ROW_NUMBER() OVER (PARTITION BY T31704.Calendar_Y00014B57 ORDER BY T31704.Calendar_Y00014B57 DESC) as c5,
    ROW_NUMBER() OVER (PARTITION BY T31704.Calendar_Y00014B57, T31704.Date_ID00016FBC ORDER BY T31704.Calendar_Y00014B57 DESC, T31704.Date_ID00016FBC DESC) as c6
    from
    SA_Day00015E8E T31704
    ) D1
    ) D1
    ) D50,
    (select distinct min(D1.c1) over (partition by D1.c8) as c1,
    min(D1.c2) over (partition by D1.c8, D1.c5) as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8
    from
    (select Case when case D1.c9 when 1 then D1.c5 else NULL end is not null then Rank() OVER ( ORDER BY case D1.c9 when 1 then D1.c5 else NULL end ASC NULLS LAST ) end as c1,
    Case when case D1.c10 when 1 then D1.c5 else NULL end is not null then Rank() OVER ( PARTITION BY D1.c8 ORDER BY case D1.c10 when 1 then D1.c5 else NULL end ASC NULLS LAST ) end as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8
    from
    (select T31704.Calendar_D00014B5B as c3,
    T31704.Calendar_M00014B4D as c4,
    T31704.Date_ID00016FBC as c5,
    T31704.Calendar_Q00014B51 as c6,
    T31704.Month_End_00014B6D as c7,
    T31704.Calendar_Y00014B57 as c8,
    ROW_NUMBER() OVER (PARTITION BY T31704.Calendar_Y00014B57 ORDER BY T31704.Calendar_Y00014B57 DESC) as c9,
    ROW_NUMBER() OVER (PARTITION BY T31704.Calendar_Y00014B57, T31704.Date_ID00016FBC ORDER BY T31704.Calendar_Y00014B57 DESC, T31704.Date_ID00016FBC DESC) as c10
    from
    SA_Day00015E8E T31704
    ) D1
    ) D1
    ) D49
    where ( T31635.Organizati00014BB3 = T31738.Organizati00014BB3 and T31723.Trade_Clas0001777D = T31738.Trade_Clas0001777D and T31635.Business_U00014BC5 = 'EVD' and T31738.Date_ID00016FBC = D50.c3 and D49.c1 = D50.c1 and D49.c4 = '2009 / 05' and (T31723.Trade_Clas0001777C in ('Redemption', 'Sale')) and D49.c2 >= D50.c2 )
    group by T31723.Trade_Clas0001777C, D49.c3, D49.c4, D49.c5, D49.c6, D49.c7, D49.c8
    ) D1
    where ( D1.c9 = 1 )
    ) D4
    order by c8, c2, c1

Maybe you are looking for