Optimizing order by query with multiple time dimensions

Hello all,
I have two time dimensions, one a standard date dimension (Year,Qtr, Month, Week, Day) the other a user defined Time dimension (All, Hour, Minute, Second).
I am joining my cube with my time dimension using only the 'All' level, so that I can get a single record for the Day level in my Date dimension. Under these circumanstances there aren't many records in my sample data. Less than 100 dates, although at the lowest level(seconds) there are approx 2 million records.
In order to get my results back in order I am ordering by the date dimension day_end_date. The query is taking longer than I would expect given that there aren't many records at the Day Level. How can I ensure that my query is ordering based only on the values in the current day_level and not all day_end_dates values in the underlying cube.

Changed order, speed improved significantly.

Similar Messages

  • How to tune performance of a cube with multiple date dimension?

    Hi, 
    I have a cube where I have a measure. Now for a turn time report I am taking the date difference of two dates and taking the average, max and min of the date difference. The graph is taking long time to load. I am using Telerik report controls. 
    Is there any way to tune up the cube performance with multiple date dimension to it? What are the key rules and beset practices for a cube to perform well? 
    Thanks, 
    Amit

    Hi amit2015,
    According to your description, you want to improve the performance of a SSAS cube with multiple date dimension. Right?
    In Analysis Services, there are many tips to improve the performance of a cube. In this scenario, I suggest you only keep one dimension, and only include the column which are required for your calculation. Please refer to "dimension design" in
    the link below:
    http://www.mssqltips.com/sqlservertip/2567/ssas--best-practices-and-performance-optimization--part-3-of-4/
    If you have any question, please feel free to ask.
    Simon Hou
    TechNet Community Support

  • Oracle hangs on query with multiple joins

    To test the sotftware from the LMS-vendor that are out partners we use virtual machines where we install Windows 2003 servers and Oracle XE
    While we were testing the software I've found that a particular query with multiple unions causes the CPU of the virtual machine totally claimed by oracle
    The query causes oracle to hang.
    I've found that the subcomponents of the query all return 0 rows (and response all immediately) combined into a query with at least 2 unions the query hangs the system
    I'm not familiar with with Database Management at all
    I've read something about SGA and PGA that could be the issue and tried to increase the target for both but it doesn't seem to do anything
    Some characterics
    Target Current
    Maximum System Global Area (SGA) Size: 380 MB 380 MB
    Program Global Area (PGA) Aggregate Target: 360 MB 38 MB
    Current Configuration: (SGA + PGA): 740 MB 418 MB
    Tablespaces Percent Used Allocated (MB) Used (MB) Datafiles
    SYSAUX 98.21% 460.00 451.75 1
    SYSTEM 73.09% 510.00 372.75 1
    DATA 99.13% 440.00 436.19 1
    UNDO 6.48% 160.00 10.38 1
    USERS 1.63% 100.00 1.63 1
    sort_area_size 65536
    shared_pool_reserved_size 5452595 TRUE size in bytes of reserved area of shared pool
    shared_pool_size 0 TRUE size in bytes of shared pool
    What other parameters are important? How could I get a good picture to see what's really going on?
    Some pointers, help would be appreciated.
    Regards,
    Remco

    Below is the base-query that is causing the problems
    SELECT /* Public - Internal learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no order_number, e.id person_id, format_name(e.fname , e.lname , @@005) learner_name , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description item_desc, substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1 , r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN tpt_oe_order_items i ON i.reg_id = r.id INNER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id INNER JOIN tpt_company c ON e.company_id = c.id INNER JOIN tpt_offering_action oa on r.offering_action_id = oa.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name INNER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name INNER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name INNER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name WHERE e.type = 100 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003))
    UNION
    SELECT /* Public - External learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , e.id person_id, format_name(e.fname , e.lname , @@005) , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1, r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN tpt_oe_order_items i ON i.reg_id = r.id INNER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id INNER JOIN tpt_offering_action oa on r.offering_action_id = oa.id LEFT OUTER JOIN tpt_company c ON e.company_id = c.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name INNER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name INNER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name INNER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name WHERE e.type = 200 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003))
    UNION
    SELECT /* Public - Unassigned learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , null person_id, null , null company_id, null , ent.id entidd, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1, r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,'' org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,'' learner_first_name ,'' learner_last_name FROM tpt_registration r INNER JOIN tpt_oe_order_items i ON i.reg_id = r.id INNER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN tpt_offering_action oa on oa.id = r.offering_action_id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name INNER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name INNER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name INNER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name WHERE r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND r.student_id is null AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 AND @@003 is null
    UNION
    SELECT /* Private - Internal learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , e.id person_id, format_name(e.fname , e.lname , @@005) , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1 , r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN let_pvt_offering_request pvt_offreq ON pvt_offreq.class_id = r.class_id INNER JOIN tpt_offering_action oa on oa.id = r.offering_action_id LEFT OUTER JOIN tpt_oe_order_items i ON i.part_id = pvt_offreq.id LEFT OUTER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id LEFT OUTER JOIN tpt_company c ON e.company_id = c.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name LEFT OUTER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' LEFT OUTER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name AND orderList.list_id = 'sysli000000000000129' AND orderList.locale_id = @@005 LEFT OUTER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name AND approvalList.list_id = 'sysli000000000000165' AND approvalList.locale_id = @@005 WHERE e.type = 100 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003))
    UNION
    SELECT /* Private - External learner */ r.id reg_id, i.id order_item_id, o.id order_id, o.order_no , e.id person_id, format_name(e.fname , e.lname , @@005) , c.id company_id, c.name2 , ent.id entid, ctype.id ctypeid, ctype.name , i.status , items.description , substr ( i.flags , 1 , 1 ) is_conf , r.status status1, rs.description description1 , r.wlist_priority , r.reg_no , r.flags , o.status status2, o.split, null learnerViewOnly, null statusViewOnly, i.approved_status, decode(substr(r.flags,2,1),'1','true','false') isWalkIn, oa.id offering_action_id, oa.status profile_status ,c.name2 org_name ,ctype.name audience_sub_type ,items.description description ,o.order_no order_no ,orderList.description order_status ,approvalList.description approval_status ,e.fname learner_first_name ,e.lname learner_last_name FROM tpt_registration r INNER JOIN let_pvt_offering_request pvt_offreq ON pvt_offreq.class_id = r.class_id INNER JOIN tpt_offering_action oa on r.offering_action_id = oa.id LEFT OUTER JOIN tpt_oe_order_items i ON i.part_id = pvt_offreq.id LEFT OUTER JOIN tpt_oe_order o ON i.order_id = o.id INNER JOIN cmt_person e ON r.student_id = e.id LEFT OUTER JOIN tpt_company c ON e.company_id = c.id LEFT OUTER JOIN tpt_roster_template_entry ent ON r.ros_temp_ent_id = ent.id LEFT OUTER JOIN tpt_customer_type ctype ON ent.customer_type_id = ctype.id INNER JOIN fgt_ext_sys_list_of_val rs ON to_char ( r.status ) = rs.name LEFT OUTER JOIN fgt_ext_sys_list_of_val items ON to_char ( i.status ) = items.name AND items.locale_id = @@005 AND items.list_id = 'sysli000000000000131' LEFT OUTER JOIN fgt_ext_sys_list_of_val orderList ON to_char ( o.status ) = orderList.name AND orderList.locale_id = @@005 AND orderList.list_id = 'sysli000000000000129' LEFT OUTER JOIN fgt_ext_sys_list_of_val approvalList ON to_char(i.approved_status) = approvalList.name AND approvalList.locale_id = @@005 AND approvalList.list_id = 'sysli000000000000165' WHERE e.type = 200 AND r.class_id = @@001 AND r.status = nvl ( to_number(@@002) , r.status ) AND rs.locale_id = @@005 AND rs.list_id = 'sysli000000000000100' AND ((@@003 is null) or (@@003 is not null and r.student_id = @@003)) ORDER BY 34,35,28,29,31,30,33,32

  • Doubt in Firing Query with multiple opportunities UUID/IDs

    HI Folks!
    I might have simple doubt but please help me on this!
    1. I have a custom BO with association to opportunities.
    [DeploymentUnit(CustomerRelationshipManagement)] businessobject Sy_Trade {
    [AlternativeKey] [Label("Trade Id")] element tradeid : BusinessTransactionDocumentID;
    node RelatedOpportunities [0,n]{
                                  element BusinessTransactionDocumentReference : BusinessTransactionDocumentReference;
                                  element BusinessTransactionDocumentRelationshipRoleCode : BusinessTransactionDocumentRelationshipRoleCode;
                                   association RelatedOpportunity[0,1] to Opportunity;
    2. I have success fully used association and i am able to view create all the opportunities related to my custom Bo.
    ISSUE : I want a facet where i just want DISPLAY the activities and sales document assigned in the RELATED OPPORTUNITIES ( N opportunities )
    How do i query with Multiple opportunities ID and fetch the activities against it?
    Btw I want to use query in UI Designer... I have created an  advanced list pane and there i want the result list
    I hope i am clear!
    Thanks in adavance...
    Regards
    Dhruvin

    Hi Ludger,
    I have successfully displayed Related Opportunities associated with trade.( i am able to create , delete also )
    Issue : I am not able to "Display" ( i don't need to edit or create ) all the activities created against all the opportunities in a different tab.
    I tried to approaches :
    1: Query : Created a Query on Activity BO and tried to pass multiple related opportunities ( but seems not possible , please tell me any possibility to pass range of opportunity via transformation or anything? )
    2 : binding : I have a Node Related Opportunity so just tried to bind it with BO model but problem is it is displaying all the activities of first opportunity of the list...
    i think why because :
    In Data model I have created a table bind with Related Opportunities...
    now that node is 1 to N , association to opportunity 0 to 1 , hence i think it fetches only 1 opportunities activity
    should i create like below ( Or is it possible)
    Node Reltdoppts[0,1]
    association [0,N] to opportunity BO ?
    Although i strongly feel SAP should provied us two things :
    1. We need to pass range of opportunities in a query.
    2. We need to just write some absl code where i can fill the table and display it
    and also is there any possibility to create a report or something to display activities as we just want to display the activities!
    P.S : I have been getting a lot of bashing from client because some of the product restriction in cloud! i hope and wish SAP give developers free hand to develop right now its like our hands are tied to many things

  • BaseTableName blank when calling GetSchema on a query with multiple tables

    I am using ODP.NET 11.2.0.3.0 and when calling GetSchemaTable on a DataReader that contains a join the returned SchemaTable has the BaseTableName and BaseColumnName fields blank - this is different than what I see with the Oracle OLE DB Provider and with how SQL Server's native provider works. I can't find any discussion of this - is this on purpose or is it a bug? why does the available schema information vary so drastically between a single table query and a query with multiple tables joined?
    Thanks,
    Bryan Hinton

    Hi Bryan,
    I am also facing the same issue. Did u find any work around or any suggestions will be well appreciated.
    Thanks,
    Naresh.

  • Time Evaluation with multiple time events

    Dear Friends,
    I have an issue in our current project. Kindly try to help me with a solution.
    We are working on Time Management module with Positive Time Recording method and evaluation- India. (Payroll module is not implemented)
    My issue is:
    Evaluation with multiple time events in a day: In our project, we have a scenario like the employees record multiple clock in and clock out times for one day and are uploaded into infotype 2011. But during time evaluation, only first Time event that is P10 (Clock In) and the last Time event P20 (Clock-out) in a day should be considered for evaluation, ignoring any multiple time entries in between duration in the table TEVEN (Infotype 2011).
    Pls let me know how this requirement can be met. Do we need to define any new PCR’s or create any functions? If yes, pls tell me the process in detail as I am new and implementing Time management (Positive Time recording with Evaluation) for first time. Try to help me as soon as possible.
    Thanks & Regards,
    Chiranjeevi
    Edited by: chiran reddy on Feb 15, 2008 2:20 PM

    is it not possible to enter only the first p10 and last p20 from the time systems into 2011.

  • APD using Query with multiple structures as a data source

    All,
    I want to set up an automatic process which executes a query and exports it to a shared drive as a csv file. I have tried various options , when I try to use APD to set up the extract, I get an error and this is because the query that I am trying to use has Strucutres in both rows and columns. Hence, I am unable to use this option. I tried RSCRM_BAPI, It works well, but there is an issue with scheduling this in Process chain. I created an event and scheduled this as a job to trigger after "event" as per SAP instructions, but the job does not exist and it is not possible to trigger it through the Process chain unless the variables are hard coded in the query which I do not want to do.
    Can any one tell me if there is a way to deal with APD using Query with multiple structures?
    Would really appreciate if some one can give me the right solution...
    Thanks

    Hi Tanu ,
    APD is an option but its not very good with large amount of data or hiearachies or if you have attributes in you query structure .
    One more option for this requirement is use of report program using function module RRW3_GET_QUERY_VIEW_DATA .
    This will work fine with multiple structure etc .
    There are some overheads with this FM  ex: if amount of data is too much then program will give dump .Solution for that is we call the FM in LOOP by diving amount of data need to be fetched .ex:  we can read data quarter wise.
    For using this function module what you can do is write an ABAP program (At SE38 ) .which will call this FM and then write the output into a flat file which you can save at application server (AL11) .From there other system can read it .
    To automate this whole process you can further add all the report programs into a process chain (RSPC) which can be schedule as per requirement .
    To pass input parameters you can use variants that will pass the values to the report .
    Check thi link for sample code :
    [http://www.tricktresor.de/content/index.php?navID=696&aID=496]
    Hope this will be helpful .
    Regards,
    Jaya Tiwari

  • Spatial Query with multiple geometries from 2 tables

    Hi,
    I'm using Oracle 8.1.7. I am trying to do a spatial query on two tables with multiple geometries. There are two spatial tables. One made up of points and one made up of polygons. There are 829551 rows in the table of points and 1817795 rows in the table with polygons...
    I want to find all polygons where one of this points is within it...
    This query is pretty intensive querying two large spatial tables against each other and so I need to find the most efficient way of running this query. I've been running variations of my query for the last two week and every time it's bombed out with various errors after 12-24 hrs processing like out of memory, out of tablespace, out of processing, invalid index etc etc etc. I need to get this query run asap... Any tips would be gratefully appreciated..
    For the session running the query I've allocated 16M sort area with
    ALTER SESSION SET SORT_AREA_SIZE=16777216;
    Below is the query I'm running... How can I improve this please? BTW PARCEL_OVERLAPS contains the points and TP$_PARCEL_AREAS the polygons.
    SELECT lu.LNU_PARCEL_ID
         FROM
              seventy.PARCEL_OVERLAPS po,
              imap_topol.TP$_PARCEL_AREAS pa,
              TP$_PARCEL_CENTROID_AREA pca,
              TDCR_LAND_UNIT lu
         WHERE
              SDO_FILTER(po.geometry, pa.area,
              'querytype=WINDOW') = ’TRUE’ and
              sdo_within_distance(po.geometry,pa.area,'distance=0')='TRUE' and
              pa.delete_date is null and
              Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
              pa.AREA_ID = pca.AREA_ID and
              pca.DELETE_DATE IS NULL and
              pa.DELETE_DATE IS NULL;

    Albert,
    Thanks for your reply and the tips you've given. The tp$_parcel_areas table will always be bigger so I've changed the order to sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE'. The requested counts for those queries are
    12:26:29 [email protected]:SQL> select count(*)
    13:46:22 2 from seventy.PARCEL_OVERLAPS;
    COUNT(*)
    612
    13:48:12 [email protected]:SQL> select count(*)
    13:48:17 2 from imap_topol.TP$_PARCEL_AREAS pa,
    13:48:21 3 TP$_PARCEL_CENTROID_AREA pca
    13:48:21 4 where pca.DELETE_DATE IS NULL
    13:48:21 5 and pa.DELETE_DATE IS NULL
    13:48:21 6 and pa.AREA_ID = pca.AREA_ID;
    COUNT(*)
    1310665
    There was no reason for both filter and within_distance. I did try use the anyinteract but for some reason that does not return the desired results(I've added one id row as a test to make sure it returns desired results). Plus Oracle have recomended using the within distance for better performance..
    so the explan plan for
    14:38:37 [email protected]:SQL> EXPLAIN PLAN FOR
    14:38:50 2 SELECT lu.LNU_PARCEL_ID
    14:38:50 3 FROM
    14:38:50 4 seventy.PARCEL_OVERLAPS po,
    14:38:50 5 imap_topol.TP$_PARCEL_AREAS pa,
    14:38:50 6 TP$_PARCEL_CENTROID_AREA pca,
    14:38:50 7 TDCR_LAND_UNIT lu
    14:38:50 8 WHERE
    14:38:50 9 sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE' and
    14:38:50 10 pa.delete_date is null and
    14:38:50 11 Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
    14:38:50 12 pa.AREA_ID = pca.AREA_ID and
    14:38:50 13 pca.DELETE_DATE IS NULL and
    14:38:50 14 pa.DELETE_DATE IS NULL;
    is
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 4G|32920G| 547M| | |
    | NESTED LOOPS | | 4G|32920G| 547M| | |
    | MERGE JOIN | | 547M| 2029G| 230124 | | |
    | SORT JOIN | | 1M| 36M| 85014 | | |
    | MERGE JOIN | | 1M| 36M| 50019 | | |
    | SORT JOIN | | 1M| 17M| 21650 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 1M| 17M| 485 | | |
    | SORT JOIN | | 1M| 22M| 28369 | | |
    | TABLE ACCESS FULL |TDCR_LAND | 1M| 22M| 2127 | | |
    | SORT JOIN | | 42K| 160M| 145111 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 42K| 160M| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    14:43:14 [email protected]:SQL> explain plan for
    14:43:23 2 SELECT pa.AREA_ID
    14:43:23 3 FROM seventy.PARCEL_OVERLAPS po,
    14:43:23 4 imap_topol.TP$_PARCEL_AREAS pa
    14:43:23 5 WHERE SDO_RELATE(po.geometry, pa.area,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:43:23 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 10M| | |
    | NESTED LOOPS | | 6M| 50G| 10M| | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    14:45:03 [email protected]:SQL> explain plan for
    14:45:04 2 SELECT pa.AREA_ID
    14:45:05 3 FROM seventy.PARCEL_OVERLAPS po,
    14:45:05 4 imap_topol.TP$_PARCEL_AREAS pa
    14:45:05 5 WHERE SDO_RELATE(pa.area, po.geometry,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:45:05 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 863554 | | |
    | NESTED LOOPS | | 6M| 50G| 863554 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    --------------------------------------------------------------------------------

  • Query executing multiple times

    All,
    This question has been come up quite often in the OTN forum and i have not managed to get the answer. The issue is when i enable the logs i can see query getting fired multiple times :
    <TracingViewObjectSqlQueryExecution> <logQueryStatementAndBindParameters> ----[Exec query for VO=Kpi, RS=<Default>]----
    <TracingViewObjectSqlQueryExecution> <logQueryStatementAndBindParameters> ----[Exec COUNT query for VO=Kpi]----
    <TracingViewObjectSqlQueryExecution> <logQueryStatementAndBindParameters> VODef =com.xxx.model.uiView.KpiVO
    <TracingViewObjectSqlQueryExecution> <logQueryStatementAndBindParameters> SELECT
    kpi.kpi,
    kpi.kpi_desc,
    kpi.target,
    kpi_pkg.get_kpi_main (kpi.kpi, kpi.sale_type, :bSelectedSalesExecutiveId, :bSelectedBranchId ,:bOperatingUnitId, :bUserRole, :bPersonId, :bKpiRefresh) achieved,
    kpi.percentage,
    kpi.sale_type
    FROM    tableName kpi   
    WHERE  kpi.sale_type = NVL (:bSaleType, kpi.sale_type)
    ORDER BY tag
    <TracingViewObjectSqlQueryExecution> <logQueryStatementAndBindParameters> BindVars:(bUserRole=SE,bOperatingUnitId=81,bPersonId=31458,bSaleType=RETAIL,bSelectedBranchId=224,bSelectedSalesExecutiveId=31458,bKpiRefresh=Y)
    <TracingViewObjectSqlQueryExecution> <getQueryHitCount> ***** Query Hit Count = 6 *****
    <TracingViewObjectSqlQueryExecution> <logQueryStatementAndBindParameters> VODef =com.xxx.model.uiView.KpiVO
    <TracingViewObjectSqlQueryExecution> <logQueryStatementAndBindParameters> SELECT
    kpi.kpi,
    kpi.kpi_desc,
    kpi.target,
    kpi_pkg.get_kpi_main (kpi.kpi, kpi.sale_type, :bSelectedSalesExecutiveId, :bSelectedBranchId ,:bOperatingUnitId, :bUserRole, :bPersonId, :bKpiRefresh) achieved,
    kpi.percentage,
    kpi.sale_type
    FROM    tableName kpi   
    WHERE  kpi.sale_type = NVL (:bSaleType, kpi.sale_type)
    ORDER BY tag
    <TracingViewObjectSqlQueryExecution> <logQueryStatementAndBindParameters> BindVars:(bUserRole=SE,bOperatingUnitId=81,bPersonId=31458,bSaleType=RETAIL,bSelectedBranchId=224,bSelectedSalesExecutiveId=31458,bKpiRefresh=Y)This is one such case. These repetitive nature of the queries getting executed is making my application slow. On the logs i can see the first time query getting executed then waiting for it to finish then the same for the second time. Can any one give some inputs on this ?
    thnks
    Jdev 11.1.1.5

    thnks Frank for your reply.
    Ideally this query is supposed to run when the page is loaded however it has a complex calculation which takes 28 secs to complete. In order to load the page fast we dragged and dropped the collection as a table and added a button which executes the query. So the query gets executed on page load with a condition set as false so that no data is fetched - to speed the page load. However when we press the Refresh button the query gets re executed but as you can see 2 times. I can see the same effect on a nos of tables.

  • Multiple time dimension hierarchies ?

    Hi, is it possible to easily define multiple hierarchies in a time based dimension ?
    I know the time dimension wizard allows the definition of only 1 hierarchy but I need to have a time dimension that has both a calendar based and a fiscal calendar hierarchy.
    It is possible to modify the dimension definition after using the wizard but I don't think the original mapping automatically generated by the wizard is updated.
    Anyone done this ?
    Thanks
    Paul

    Hi,
    Did any of you manage to create the extra hierarchy in the time dimension?
    I also created the standard time dimension with only one fiscal hierarchy first, but later found the need to add another fiscal hierarchy that has month as the leaf level (does not include day level). However, when deploying, I get the message "ORA-00957: duplicate column name"...
    (Reason for defining other hierarchy without the day level is that it seems that when using auto-solve on a compressed cube, it tries to solve from all leaf levels upward, but one cube I have is loaded at the month level of the time dimension... day level is not applicable in this specific cube. Using the standard fiscal hierarchy in this case does not work on that cube.)
    Thanks,
    Ed
    PS Looking at the ddl script from the Job Details window, the duplicate columns are in the auto generated stage tables/views (for month and quarter level; not for year level(?)). How can we influence OWB to generate the correct things???
    Create table "OWB$STGTBL_D_DI_FISCAL__2B6926" (
    FISCAL_QUARTER_F_2B69262B6934 number,
    FISCAL_QUARTER_F_2B69262B6934 number);
    Create table "OWB$STGTBL_D_DI_FISCAL__2B6915" (
    FISCAL_MONTH_FI_2B69152B6926 number,
    FISCAL_MONTH_FI_2B69152B6926 number);
    Message was edited by:
    EdSp

  • Query with multiple outer joins

    I had a doubt with whether the following kind of query is valid with multiple outer-joins. The format of the query is something like this:-
    select A.col1, B.col2
    from table1 A, table2 B, table3 C where
    A.col3=B.col4(+) and B.col5=C.col6(+)
    This would mean the follwoing with regard to outer-joins in the query.
    1) fetch records with col3 in table A matching or not matching col4 in table B
    2) fetch records with col5 in table B matching or not matching col6 in table C
    So, this query is valid?
    I hope, my question is clear.
    Please, help in solving the doubt.
    regards

    This is valid and it works fine

  • How to create the query with multiple node types

    Hi,
    I am having an issue in creating a query to search multiple node types.
    The requirement is to query documents/pages of the type dam:Asset and cq:Page present under a path.
    I tried the following code snippet with no luck .
    path=/content
    1_type=cq:Page
    2_type=dam:Asset
    property=jcr:content/metadata/@cq:tags
    property.1_value=<tag Name>
    I was able to write a query with single type. However i could not find any documents/ materials with multipe types as shown above.
    Thanks in advance.
    Regards
    Sudhi

    I don't think multiple type is possible. Instead use super type like nt:base that will cover both page and asset.
    Yogesh
    www.wemblog.com

  • OracleBI Spreadsheet Add-in Not Working With ROLAP TIME Dimension

    Hello,
    I've been trying to figure this bizarre behavior for a while now.
    I have created a TIME dimension (based on a relational table) using OEM and defined the metadata etc. My hierarchy has 4 levels: day->month->quarter->year. I have end_date and time_span attributes defined for each level. I have defined a simple cube dimensioned by TIME and having only 1 numeric measure.
    When I open BI Spreadsheet Add-in, I can see my cube measure and the dimension in the list of available entities. I add them to the list of selected entities and hit 'next'. On the next screen I arrange them to my liking and hit 'next' again. This is where the problem occurs. Or rather where nothing occurs. The add-in just gets stuck at this point and no matter what I do or click, it won't advance to the next step.
    If I change the dimension type from time to normal, then everything works as expected (although, I cannot do time-series analysis).
    If I create and enable an analytic workspace and use it in the add-in, then everything works as expected as well.
    Any ideas what's wrong here? I kind of suspect the end_date and time_span attributes are involved somehow...
    Thanks!
    Dobo

    The expected format for a relational time table would be something like the following:
    CREATE TABLE "BIBDEMO"."BIBDEMO_TIME"
    ("TIME_STD_MONTH" VARCHAR2(30),
    "TIME_STD_MONTH_LLABEL" VARCHAR2(60),
    "TIME_STD_MONTH_SLABEL" VARCHAR2(30),
    "TIME_STD_QUARTER" VARCHAR2(30),
    "TIME_STD_QUARTER_LLABEL" VARCHAR2(60),
    "TIME_STD_QUARTER_SLABEL" VARCHAR2(30),
    "TIME_STD_YEAR" VARCHAR2(30),
    "TIME_STD_YEAR_LLABEL" VARCHAR2(60),
    "TIME_STD_YEAR_SLABEL" VARCHAR2(30),
    "TIME_YTD_YEAR" VARCHAR2(30),
    "TIME_YTD_YEAR_LLABEL" VARCHAR2(60),
    "TIME_YTD_YEAR_SLABEL" VARCHAR2(30),
    CONSTRAINT BIBDEMO_TIME_PK PRIMARY KEY("TIME_STD_MONTH")
    ALTER TABLE "BIBDEMO"."BIBDEMO_TIME"
    ADD ("TIME_STD_MONTH_END_DATE" DATE,
    "TIME_STD_QUARTER_END_DATE" DATE,
    "TIME_STD_YEAR_END_DATE" DATE,
    "TIME_YTD_YEAR_END_DATE" DATE) ;
    ALTER TABLE "BIBDEMO"."BIBDEMO_TIME"
    ADD ("TIME_STD_MONTH_TIMESPAN" NUMBER,
    "TIME_STD_QUARTER_TIMESPAN" NUMBER,
    "TIME_STD_YEAR_TIMESPAN" NUMBER,
    "TIME_YTD_YEAR_TIMESPAN" NUMBER) ;
    and the metadata registration script should look something like this:
    -- This script modifies the bibdemo_time lookup table and bibdemo TIME dimension. It adds a period end date attribute.
    ALTER TABLE "BIBDEMO"."BIBDEMO_TIME"
    ADD ("TIME_STD_MONTH_END_DATE" DATE,
    "TIME_STD_QUARTER_END_DATE" DATE,
    "TIME_STD_YEAR_END_DATE" DATE,
    "TIME_YTD_YEAR_END_DATE" DATE) ;
    ALTER TABLE "BIBDEMO"."BIBDEMO_TIME"
    ADD ("TIME_STD_MONTH_TIMESPAN" NUMBER,
    "TIME_STD_QUARTER_TIMESPAN" NUMBER,
    "TIME_STD_YEAR_TIMESPAN" NUMBER,
    "TIME_YTD_YEAR_TIMESPAN" NUMBER) ;
    begin
    dbms_output.put_line('Drop level attributes of TIME prior to recreation.');
    cwm_olap_dim_attribute.remove_level_attribute('BIBDEMO', 'TIME', 'Long Description', 'L1', 'TIME_STD_YEAR_LLABEL');
    cwm_olap_dim_attribute.remove_level_attribute('BIBDEMO', 'TIME', 'Short Description', 'L1', 'TIME_STD_YEAR_SLABEL');
    cwm_olap_dim_attribute.remove_level_attribute('BIBDEMO', 'TIME', 'Long Description', 'L2', 'TIME_STD_QUARTER_LLABEL');
    cwm_olap_dim_attribute.remove_level_attribute('BIBDEMO', 'TIME', 'Short Description', 'L2', 'TIME_STD_QUARTER_SLABEL');
    cwm_olap_dim_attribute.remove_level_attribute('BIBDEMO', 'TIME', 'Long Description', 'L3', 'TIME_STD_MONTH_LLABEL');
    cwm_olap_dim_attribute.remove_level_attribute('BIBDEMO', 'TIME', 'Short Description', 'L3', 'TIME_STD_MONTH_SLABEL');
    cwm_olap_dim_attribute.remove_level_attribute('BIBDEMO', 'TIME', 'Long Description', 'L4', 'TIME_YTD_YEAR_LLABEL');
    cwm_olap_dim_attribute.remove_level_attribute('BIBDEMO', 'TIME', 'Short Description', 'L4', 'TIME_YTD_YEAR_SLABEL');
    commit;
    exception
    when others then
    dbms_output.put_line('ERROR: unexpected exception during seeding');
    cwm_utility.dump_error;
    rollback;
    raise;
    end;
    ALTER DIMENSION BIBDEMO.TIME
    DROP ATTRIBUTE L1
    DROP ATTRIBUTE L2
    DROP ATTRIBUTE L3
    DROP ATTRIBUTE L4;
    ALTER DIMENSION BIBDEMO.TIME
    ADD ATTRIBUTE L1 DETERMINES
    (BIBDEMO_TIME.TIME_STD_YEAR_LLABEL,
    BIBDEMO_TIME.TIME_STD_YEAR_SLABEL,
    BIBDEMO_TIME.TIME_STD_YEAR_END_DATE,
    BIBDEMO_TIME.TIME_STD_YEAR_TIMESPAN)
    ADD ATTRIBUTE L2 DETERMINES
    (BIBDEMO_TIME.TIME_STD_QUARTER_LLABEL,
    BIBDEMO_TIME.TIME_STD_QUARTER_SLABEL,
    BIBDEMO_TIME.TIME_STD_QUARTER_END_DATE,
    BIBDEMO_TIME.TIME_STD_QUARTER_TIMESPAN)
    ADD ATTRIBUTE L3 DETERMINES
    (BIBDEMO_TIME.TIME_STD_MONTH_LLABEL,
    BIBDEMO_TIME.TIME_STD_MONTH_SLABEL,
    BIBDEMO_TIME.TIME_STD_MONTH_END_DATE,
    BIBDEMO_TIME.TIME_STD_MONTH_TIMESPAN)
    ADD ATTRIBUTE L4 DETERMINES
    (BIBDEMO_TIME.TIME_YTD_YEAR_LLABEL,
    BIBDEMO_TIME.TIME_YTD_YEAR_SLABEL,
    BIBDEMO_TIME.TIME_YTD_YEAR_END_DATE,
    BIBDEMO_TIME.TIME_YTD_YEAR_TIMESPAN);
    declare
    timespan_desc_id number;
    enddate_desc_id number;
    TIME_DIM_ATTRIB_TYPE constant varchar2(30) := 'DIMENSION ATTRIBUTE';
    TIME_ATTRIBUTE_TYPE constant varchar2(30) := 'LEVEL ATTRIBUTE';
    begin
    dbms_output.put_line('Create end_date and timespan attributes of TIME for BIBDEMO schema');
    begin
    cwm_olap_level_attribute.set_name('BIBDEMO', 'TIME', 'L1', 'TIME_STD_YEAR_END_DATE', 'TIME_STD_YEAR_END_DATE');
    cwm_olap_level_attribute.set_name('BIBDEMO', 'TIME', 'L2', 'TIME_STD_QUARTER_END_DATE', 'TIME_STD_QUARTER_END_DATE');
    cwm_olap_level_attribute.set_name('BIBDEMO', 'TIME', 'L3', 'TIME_STD_MONTH_END_DATE', 'TIME_STD_MONTH_END_DATE');
    cwm_olap_level_attribute.set_name('BIBDEMO', 'TIME', 'L4', 'TIME_YTD_YEAR_END_DATE', 'TIME_YTD_YEAR_END_DATE');
    cwm_olap_level_attribute.set_name('BIBDEMO', 'TIME', 'L1', 'TIME_STD_YEAR_TIMESPAN', 'TIME_STD_YEAR_TIMESPAN');
    cwm_olap_level_attribute.set_name('BIBDEMO', 'TIME', 'L2', 'TIME_STD_QUARTER_TIMESPAN', 'TIME_STD_QUARTER_TIMESPAN');
    cwm_olap_level_attribute.set_name('BIBDEMO', 'TIME', 'L3', 'TIME_STD_MONTH_TIMESPAN', 'TIME_STD_MONTH_TIMESPAN');
    cwm_olap_level_attribute.set_name('BIBDEMO', 'TIME', 'L4', 'TIME_YTD_YEAR_TIMESPAN', 'TIME_YTD_YEAR_TIMESPAN');
    cwm_olap_dim_attribute.create_dimension_attribute('BIBDEMO', 'TIME', 'End_Date', 'End_Date', 'End Date of time period');
    cwm_olap_dim_attribute.create_dimension_attribute('BIBDEMO', 'TIME', 'Time_Span', 'Time_Span', 'Number of days in time period');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Long Description', 'L1', 'TIME_STD_YEAR_LLABEL');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Short Description', 'L1', 'TIME_STD_YEAR_SLABEL');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'End_Date', 'L1', 'TIME_STD_YEAR_END_DATE');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Time_Span', 'L1', 'TIME_STD_YEAR_TIMESPAN');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Long Description', 'L2', 'TIME_STD_QUARTER_LLABEL');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Short Description', 'L2', 'TIME_STD_QUARTER_SLABEL');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'End_Date', 'L2', 'TIME_STD_QUARTER_END_DATE');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Time_Span', 'L2', 'TIME_STD_QUARTER_TIMESPAN');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Long Description', 'L3', 'TIME_STD_MONTH_LLABEL');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Short Description', 'L3', 'TIME_STD_MONTH_SLABEL');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'End_Date', 'L3', 'TIME_STD_MONTH_END_DATE');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Time_Span', 'L3', 'TIME_STD_MONTH_TIMESPAN');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Long Description', 'L4', 'TIME_YTD_YEAR_LLABEL');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Short Description', 'L4', 'TIME_YTD_YEAR_SLABEL');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'End_Date', 'L4', 'TIME_YTD_YEAR_END_DATE');
    cwm_olap_dim_attribute.add_level_attribute('BIBDEMO', 'TIME', 'Time_Span', 'L4', 'TIME_YTD_YEAR_TIMESPAN');
    begin
    SELECT descriptor_id INTO enddate_desc_id
    FROM all_olap_descriptors
    WHERE descriptor_value = 'End Date'
    AND descriptor_type = 'Time Dimension Attribute Type';
    begin
    dbms_output.put_line('Classify entity descriptor use end date for TIME');
    begin
    cwm_classify.add_entity_descriptor_use(enddate_desc_id, TIME_DIM_ATTRIB_TYPE, 'BIBDEMO', 'TIME', 'End_Date');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    begin
    cwm_classify.add_entity_descriptor_use(enddate_desc_id, TIME_ATTRIBUTE_TYPE, 'BIBDEMO', 'TIME', 'L3', 'TIME_STD_MONTH_END_DATE');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    begin
    cwm_classify.add_entity_descriptor_use(enddate_desc_id, TIME_ATTRIBUTE_TYPE, 'BIBDEMO', 'TIME', 'L2', 'TIME_STD_QUARTER_END_DATE');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    begin
    cwm_classify.add_entity_descriptor_use(enddate_desc_id, TIME_ATTRIBUTE_TYPE, 'BIBDEMO', 'TIME', 'L1', 'TIME_STD_YEAR_END_DATE');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    begin
    cwm_classify.add_entity_descriptor_use(enddate_desc_id, TIME_ATTRIBUTE_TYPE, 'BIBDEMO', 'TIME', 'L4', 'TIME_YTD_YEAR_END_DATE');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    end;
    end;
    begin
    SELECT descriptor_id INTO timespan_desc_id
    FROM all_olap_descriptors
    WHERE descriptor_value = 'Time Span'
    AND descriptor_type = 'Time Dimension Attribute Type';
    begin
    dbms_output.put_line('Classify entity descriptor use time span for TIME');
    begin
    cwm_classify.add_entity_descriptor_use(timespan_desc_id, TIME_DIM_ATTRIB_TYPE, 'BIBDEMO', 'TIME', 'Time_Span');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    begin
    cwm_classify.add_entity_descriptor_use(timespan_desc_id, TIME_ATTRIBUTE_TYPE, 'BIBDEMO', 'TIME', 'L3', 'TIME_STD_MONTH_TIMESPAN');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    begin
    cwm_classify.add_entity_descriptor_use(timespan_desc_id, TIME_ATTRIBUTE_TYPE, 'BIBDEMO', 'TIME', 'L2', 'TIME_STD_QUARTER_TIMESPAN');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    begin
    cwm_classify.add_entity_descriptor_use(timespan_desc_id, TIME_ATTRIBUTE_TYPE, 'BIBDEMO', 'TIME', 'L1', 'TIME_STD_YEAR_TIMESPAN');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    begin
    cwm_classify.add_entity_descriptor_use(timespan_desc_id, TIME_ATTRIBUTE_TYPE, 'BIBDEMO', 'TIME', 'L4', 'TIME_YTD_YEAR_TIMESPAN');
    exception
    when cwm_exceptions.element_already_exists
    then null;
    end;
    end;
    end;
    end;
    commit;
    exception
    when others then
    dbms_output.put_line('ERROR: unexpected exception during seeding');
    cwm_utility.dump_error;
    rollback;
    raise;
    end;
    --UPDATE "BIBDEMO"."BIBDEMO_TIME" SET TIME_STD_MONTH_END_DATE = LAST_DAY(TO_DATE( time_std_month , 'monyy'));
    --UPDATE "BIBDEMO"."BIBDEMO_TIME" t SET TIME_STD_QUARTER_END_DATE = (select max(t1.time_std_month_end_date) from bibdemo_time t1 where t1.time_std_quarter = t.time_std_quarter group by t1.time_std_quarter) ;
    --UPDATE "BIBDEMO"."BIBDEMO_TIME" t SET TIME_STD_YEAR_END_DATE = (select max(t1.time_std_month_end_date) from bibdemo_time t1 where t1.time_std_year = t.time_std_year group by t1.time_std_year) ;
    update bibdemo_time set time_std_month_end_date = to_date('31-JAN-2000', 'dd-mon-yyyy') where time_std_month = 'JAN00';
    update bibdemo_time set time_std_month_end_date = to_date('29-FEB-2000', 'dd-mon-yyyy') where time_std_month = 'FEB00';
    update bibdemo_time set time_std_month_end_date = to_date('31-MAR-2000', 'dd-mon-yyyy') where time_std_month = 'MAR00';
    update bibdemo_time set time_std_month_end_date = to_date('30-APR-2000', 'dd-mon-yyyy') where time_std_month = 'APR00';
    update bibdemo_time set time_std_month_end_date = to_date('31-MAY-2000', 'dd-mon-yyyy') where time_std_month = 'MAY00';
    update bibdemo_time set time_std_month_end_date = to_date('30-JUN-2000', 'dd-mon-yyyy') where time_std_month = 'JUN00';
    update bibdemo_time set time_std_month_end_date = to_date('31-JUL-2000', 'dd-mon-yyyy') where time_std_month = 'JUL00';
    update bibdemo_time set time_std_month_end_date = to_date('31-AUG-2000', 'dd-mon-yyyy') where time_std_month = 'AUG00';
    update bibdemo_time set time_std_month_end_date = to_date('30-SEP-2000', 'dd-mon-yyyy') where time_std_month = 'SEP00';
    update bibdemo_time set time_std_month_end_date = to_date('31-OCT-2000', 'dd-mon-yyyy') where time_std_month = 'OCT00';
    update bibdemo_time set time_std_month_end_date = to_date('30-NOV-2000', 'dd-mon-yyyy') where time_std_month = 'NOV00';
    update bibdemo_time set time_std_month_end_date = to_date('31-DEC-2000', 'dd-mon-yyyy') where time_std_month = 'DEC00';
    update bibdemo_time set time_std_month_end_date = to_date('31-JAN-2001', 'dd-mon-yyyy') where time_std_month = 'JAN01';
    update bibdemo_time set time_std_month_end_date = to_date('28-FEB-2001', 'dd-mon-yyyy') where time_std_month = 'FEB01';
    update bibdemo_time set time_std_month_end_date = to_date('31-MAR-2001', 'dd-mon-yyyy') where time_std_month = 'MAR01';
    update bibdemo_time set time_std_month_end_date = to_date('30-APR-2001', 'dd-mon-yyyy') where time_std_month = 'APR01';
    update bibdemo_time set time_std_month_end_date = to_date('31-MAY-2001', 'dd-mon-yyyy') where time_std_month = 'MAY01';
    update bibdemo_time set time_std_quarter_end_date = to_date('30-JUN-2000', 'dd-mon-yyyy') where time_std_quarter = 'Q2.00';
    update bibdemo_time set time_std_quarter_end_date = to_date('30-SEP-2000', 'dd-mon-yyyy') where time_std_quarter = 'Q3.00';
    update bibdemo_time set time_std_quarter_end_date = to_date('31-DEC-2000', 'dd-mon-yyyy') where time_std_quarter = 'Q4.00';
    update bibdemo_time set time_std_quarter_end_date = to_date('31-MAR-2000', 'dd-mon-yyyy') where time_std_quarter = 'Q1.00';
    update bibdemo_time set time_std_quarter_end_date = to_date('31-MAR-2001', 'dd-mon-yyyy') where time_std_quarter = 'Q1.01';
    update bibdemo_time set time_std_quarter_end_date = to_date('31-MAY-2001', 'dd-mon-yyyy') where time_std_quarter = 'Q2.01';
    update bibdemo_time set time_std_year_end_date = to_date('31-DEC-2000', 'dd-mon-yyyy') where time_std_year = '2000';
    update bibdemo_time set time_std_year_end_date = to_date('31-MAY-2001', 'dd-mon-yyyy') where time_std_year = '2001';
    update bibdemo_time set time_ytd_year_end_date = to_date('31-DEC-2000', 'dd-mon-yyyy') where time_ytd_year = '2000';
    update bibdemo_time set time_ytd_year_end_date = to_date('31-MAY-2001', 'dd-mon-yyyy') where time_ytd_year = '2001';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'JAN00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 29 where "TIME_STD_MONTH" = 'FEB00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'MAR00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 30 where "TIME_STD_MONTH" = 'APR00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'MAY00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 30 where "TIME_STD_MONTH" = 'JUN00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'JUL00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'AUG00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 30 where "TIME_STD_MONTH" = 'SEP00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'OCT00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 30 where "TIME_STD_MONTH" = 'NOV00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'DEC00';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'JAN01';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 28 where "TIME_STD_MONTH" = 'FEB01';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'MAR01';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 30 where "TIME_STD_MONTH" = 'APR01';
    update "BIBDEMO"."BIBDEMO_TIME" set "TIME_STD_MONTH_TIMESPAN" = 31 where "TIME_STD_MONTH" = 'MAY01';
    update "BIBDEMO"."BIBDEMO_TIME" t
    set "TIME_STD_QUARTER_TIMESPAN" = (
    select sum(t1.time_std_month_timespan)
    from bibdemo_time t1
    where t."TIME_STD_QUARTER" = t1.time_std_quarter
    group by t1.time_std_quarter
    update "BIBDEMO"."BIBDEMO_TIME" t
    set "TIME_STD_YEAR_TIMESPAN" = (
    select sum(t1.time_std_month_timespan)
    from bibdemo_time t1
    where t."TIME_STD_YEAR" = t1.time_std_year
    group by t1.time_std_year
    update "BIBDEMO"."BIBDEMO_TIME" t
    set "TIME_YTD_YEAR_TIMESPAN" = (
    select sum(t1.time_std_month_timespan)
    from bibdemo_time t1
    where t."TIME_YTD_YEAR" = t1.time_ytd_year
    group by t1.time_ytd_year
    commit;
    quit;
    Hope this helps
    Business Intelligence Beans Product Management Team
    Oracle Corporation

  • Performance tuning of sql query with multiple joins

    My query takes at least half an hour to execute and the number of records returned are approx 1 lakh records.
    Structure of tables are:
    tblSession : ID,option1,option2,option3,option4,option5,option6,option7,option8,option9.
    tblOption : ID, labelID
    tblLabelDetail  : ID, LABELID, text
    optionID 1 to optionID9 are Foreign keys to table tblOption.ID
    My query is as below : 
    select 
    session.ID 
    ,session.tstamp
    ,session.score
    ,session.hid1
    ,session.hID2
    ,session.hID3
    ,session.collectionID
    ,session.consumerID
    ,session.langID
    ,cons_cust.text1 as    customCons_text1, 
    cons_cust.text2 as customCons_text2, 
    cons_cust.text3 as customCons_text3,
    cons_cust.text4 as customCons_text4,
    cons_cust.text5 as customCons_text5,
    cons_cust.text6 as customCons_text6,
    cons_cust.text7 as customCons_text7,
    cons_cust.text8 as customCons_text8,
    cons_cust.text9 as customCons_text9,
    ld_cons1.text as customCons_option1GUID, 
    ld_cons2.text as customCons_option2GUID, 
    ld_cons3.text as customCons_option3GUID, 
    ld_cons4.text as customCons_option4GUID ,
    ld_cons5.text as customCons_option5GUID, 
    ld_cons6.text as customCons_option6GUID, 
    ld_cons7.text as customCons_option7GUID, 
    ld_cons8.text as customCons_option8GUID, 
    ld_cons9.text as customCons_option9GUID,
    --session
    session_cust.text1 as  session_cust_text1, 
    session_cust.text2 as session_cust_text2, 
    session_cust.text3 as session_cust_text3,
    session_cust.text4 as session_cust_text4,
    session_cust.text5 as session_cust_text5,
    session_cust.text6 as session_cust_text6,
    session_cust.text7 as session_cust_text7,
    session_cust.text8 as session_cust_text8,
    session_cust.text9 as session_cust_text9,
    ld_sess1.text as session_cust_option1GUID, 
    ld_sess2.text as session_cust_option2GUID, 
    ld_sess3.text as session_cust_option3GUID, 
    ld_sess4.text as session_cust_option4GUID, 
    ld_sess5.text as session_cust_option5GUID, 
    ld_sess6.text as session_cust_option6GUID, 
    ld_sess7.text as session_cust_option7GUID, 
    ld_sess8.text as session_cust_option8GUID, 
    ld_sess9.text as session_cust_option9GUID, 
    session_cust.tStamp1,
    session_cust.tStamp2
    from mvSession session with (noexpand)
    inner join tblCollection c on c.ID=session.collectionID AND c.templateID = 405
    left join tblConsumer cons on cons.ID=session.consumerID and cons.sessionYM between 601 and 1412 and cons.sID=105
    left join vCustomConsumer cons_cust on cons_cust.sessionYM between 601 and 1412 and cons_cust.sID=105 and cons_cust.ID=cons.ID
    left join tbloption o_cons1 on o_cons1.id = cons_cust.option1 and  o_cons1.sid = 105
    left join tblLabelDetail ld_cons1 on ld_cons1.labelID = o_cons1.labelID and ld_cons1.langId = 1 and ld_cons1.eid = 107 
    left join tbloption o_cons2 on o_cons2.id = cons_cust.option2 and  o_cons2.sid = 105
    left join tblLabelDetail ld_cons2 on ld_cons2.labelID = o_cons2.labelID and ld_cons2.langId = 1 and ld_cons2.eid = 107 
    left join tbloption o_cons3 on o_cons3.id = cons_cust.option3 and  o_cons3.sid = 105
    left join tblLabelDetail ld_cons3 on ld_cons3.labelID = o_cons1.labelID and ld_cons3.langId = 1 and ld_cons3.eid = 107 
    left join tbloption o_cons4 on o_cons4.id = cons_cust.option4 and  o_cons4.sid = 105
    left join tblLabelDetail ld_cons4 on ld_cons4.labelID = o_cons4.labelID and ld_cons4.langId = 1 and ld_cons4.eid = 107 
    left join tbloption o_cons5 on o_cons5.id = cons_cust.option5 and  o_cons5.sid = 105
    left join tblLabelDetail ld_cons5 on ld_cons5.labelID = o_cons5.labelID and ld_cons5.langId = 1 and ld_cons5.eid = 107 
    left join tbloption o_cons6 on o_cons6.id = cons_cust.option6 and  o_cons6.sid = 105
    left join tblLabelDetail ld_cons6 on ld_cons6.labelID = o_cons6.labelID and ld_cons6.langId = 1 and ld_cons6.eid = 107 
    left join tbloption o_cons7 on o_cons7.id = cons_cust.option7 and  o_cons7.sid = 105
    left join tblLabelDetail ld_cons7 on ld_cons7.labelID = o_cons7.labelID and ld_cons7.langId = 1 and ld_cons7.eid = 107 
    left join tbloption o_cons8 on o_cons8.id = cons_cust.option8 and  o_cons8.sid = 105
    left join tblLabelDetail ld_cons8 on ld_cons8.labelID = o_cons8.labelID and ld_cons8.langId = 1 and ld_cons8.eid = 107 
    left join tbloption o_cons9 on o_cons9.id = cons_cust.option9 and  o_cons9.sid = 105
    left join tblLabelDetail ld_cons9 on ld_cons9.labelID = o_cons9.labelID and ld_cons9.langId = 1 and ld_cons9.eid = 107 
    left join vCustomSession session_cust on session_cust.sessionYM between 601 and 1412 and session_cust.sID=105 and session_cust.ID=session.ID
    left join tbloption o_sess1 on o_sess1.id = session_cust.option1 and  o_sess1.sid = 105
    left join tblLabelDetail ld_sess1 on ld_sess1.labelID = o_sess1.labelID and ld_sess1.langId = 1 and ld_sess1.eid = 107 
    left join tbloption o_sess2 on o_sess2.id = session_cust.option2 and  o_sess2.sid = 105
    left join tblLabelDetail ld_sess2 on ld_sess2.labelID = o_sess2.labelID and ld_sess2.langId = 1 and ld_sess2.eid = 107 
    left join tbloption o_sess3 on o_sess2.id = session_cust.option3 and  o_sess3.sid = 105
    left join tblLabelDetail ld_sess3 on ld_sess3.labelID = o_sess2.labelID and ld_sess3.langId = 1 and ld_sess3.eid = 107 
    left join tbloption o_sess4 on o_sess4.id = session_cust.option4 and  o_sess4.sid = 105
    left join tblLabelDetail ld_sess4 on ld_sess4.labelID = o_sess4.labelID and ld_sess4.langId = 1 and ld_sess4.eid = 107 
    left join tbloption o_sess5 on o_sess5.id = session_cust.option5 and  o_sess5.sid = 105
    left join tblLabelDetail ld_sess5 on ld_sess5.labelID = o_sess5.labelID and ld_sess5.langId = 1 and ld_sess5.eid = 107 
    left join tbloption o_sess6 on o_sess6.id = session_cust.option6 and  o_sess6.sid = 105
    left join tblLabelDetail ld_sess6 on ld_sess6.labelID = o_sess6.labelID and ld_sess6.langId = 1 and ld_sess6.eid = 107 
    left join tbloption o_sess7 on o_sess7.id = session_cust.option7 and  o_sess7.sid = 105
    left join tblLabelDetail ld_sess7 on ld_sess7.labelID = o_sess7.labelID and ld_sess7.langId = 1 and ld_sess7.eid = 107 
    left join tbloption o_sess8 on o_sess8.id = session_cust.option8 and  o_sess8.sid = 105
    left join tblLabelDetail ld_sess8 on ld_sess8.labelID = o_sess8.labelID and ld_sess8.langId = 1 and ld_sess8.eid = 107 
    left join tbloption o_sess9 on o_sess9.id = session_cust.option9 and  o_sess9.sid = 105
    left join tblLabelDetail ld_sess9 on ld_sess9.labelID = o_sess9.labelID and ld_sess9.langId = 1 and ld_sess9.eid = 107 
    where session.sID=105  and session.tStamp >= 'Sep  1 2014 12:00AM' and session.tStamp < 'Dec 12 2014 12:00AM'   
    order by session.tStamp, session.ID
    Is there a way , where i can simplify the joins with tbloption and tblLabelDetail and get my o/p in optimal time.
    Regards 

    I have headed towards another approach ie. using unpivot and then pivot.
    First i am converting option1-option9 into column , then doing  PIVOT to get back the same record . But issue is that when i am doing pivoting i am getting NULL values.
    My query is :
    select * into #t1  from
    select ID
    , option1
    , option2
    , option3
    , option4
    , option5
    , option6
    , option7
    , option8
    , option9
    from vCustomConsumer
    where sid=105
    and sessionYM = 1412 
    ) SourceTable
    UNPIVOT
       optionID FOR Col IN
        (option1 
    ,option2
    ,option3 
    ,option4 
    ,option5 
    ,option6 
    ,option7 
    ,option8 
    ,option9 )
    ) AS unpvt
    select t.ID,t.optionID,t.col,cast(ld.text as varchar(max)) as text into #t2
    from #t1 t
    left outer join tbloption o on o.ID =  t.optionID
    left outer join tblLabelDetail ld on ld.labelID = o.labelID and ld.langID=1 
    order by ID,col
    select ID,option1 
    ,option2
    ,[option3]
    ,option4 
    ,option5 
    ,option6 
    ,option7 
    ,option8 
    ,option9
    from
    select ID,optionID,col,text
    from #t2
    )up
    pivot 
    min(text)for col in 
    (option1 
    ,option2
    ,[option3]
    ,option4 
    ,option5 
    ,option6 
    ,option7 
    ,option8 
    ,option9
    )as pvt
    In my last query where i am using pivot, i am getting NULL values. When i check the data in temp table #t2 , it exists perfectly . But when pivoting i dont understand why it is returning most of the NULL values. I am getting data for only one column in single
    row.
    Below are some rows from result set finally obtained after pivoting :
    ID
    option1
    option2
    option3
    option4
    option5
    option6
    option7
    option8
    option9
    62949026
    NULL
    0 to 200 seconds
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    62966000
    NULL
    NULL
    4
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    62966032
    NULL
    NULL
    4
    NULL
    NULL
    NULL
    NULL
    NULL
    NULL
    63090372
    NULL
    NULL
    NULL
    NULL
    EN
    NULL
    NULL
    NULL
    NULL
    63090375
    NULL
    NULL
    NULL
    NULL
    EN
    NULL
    NULL
    NULL
    NULL
    Thanks,

  • Problems with multiple Attribute Dimensions

    Hello Guys,
    when i try to get data from an Essbase database using the Grid API with more then one Attribute Dimension,
    the server needs a very long time to response or doesn't response at all.
    I encounter the same behaviour when i perform a query using the Excel Query Designer.
    Here is a sample query log output:
    <subquery>
    <cluster size="1">
    <dim size="1"><member>MEASURE</member></dim>
    <dim size="1"><member>PERIOD</member></dim>
    <dim size="1"><member>YEAR</member></dim>
    <dim size="1"><member>CATEGORY</member></dim>
    <dim size="1"><member>CURRENCY</member></dim>
    <dim size="1"><member>CUSTOMER</member></dim>
    <dim size="1"><member>PRODUCT</member></dim>
    <dim size="1"><member>Business</member></dim>
    <dim size="1"><member>black</member></dim>
    <dim size="1"><member>Attribute Calculations</member></dim>
    </cluster>
    </subquery>
    <elapsedtime>94.217 seconds
    Any help would be appreciated.
    Regards,
    Martin Brandl

    Thanks for the swift response. Always ideas are useful.
    As of now , Middleware cannot split the file.
    Thing is SAP is creating two Idocs with different message types. Problem is First IDoc contains ORDERS message type but also DELIVERY segments as well. Second IDoc with DELIVERY message tyoe but ORDERS segments as well... This is the problem... I think we are missing some field activation in file for EDIDC record.
    As far as I know file port supports the number of IDocs in one file.. Hope TRFC port also supports that

Maybe you are looking for