Why this Query is taking much longer time than expected?

Hi,
I need experts support on the below mentioned issue:
Why this Query is taking much longer time than expected? Sometimes I am getting connection timeout error. Is there any better way to achieve result in shortest time.  Below, please find the DDL & DML:
DDL
BHDCollections
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BHDCollections](
 [BHDCollectionid] [bigint] IDENTITY(1,1) NOT NULL,
 [GroupMemberid] [int] NOT NULL,
 [BHDDate] [datetime] NOT NULL,
 [BHDShift] [varchar](10) NULL,
 [SlipValue] [decimal](18, 3) NOT NULL,
 [ProcessedValue] [decimal](18, 3) NOT NULL,
 [BHDRemarks] [varchar](500) NULL,
 [Createdby] [varchar](50) NULL,
 [Createdon] [datetime] NULL,
 CONSTRAINT [PK_BHDCollections] PRIMARY KEY CLUSTERED
 [BHDCollectionid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
BHDCollectionsDet
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[BHDCollectionsDet](
 [CollectionDetailid] [bigint] IDENTITY(1,1) NOT NULL,
 [BHDCollectionid] [bigint] NOT NULL,
 [Currencyid] [int] NOT NULL,
 [Denomination] [decimal](18, 3) NOT NULL,
 [Quantity] [int] NOT NULL,
 CONSTRAINT [PK_BHDCollectionsDet] PRIMARY KEY CLUSTERED
 [CollectionDetailid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
Banks
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Banks](
 [Bankid] [int] IDENTITY(1,1) NOT NULL,
 [Bankname] [varchar](50) NOT NULL,
 [Bankabbr] [varchar](50) NULL,
 [BankContact] [varchar](50) NULL,
 [BankTel] [varchar](25) NULL,
 [BankFax] [varchar](25) NULL,
 [BankEmail] [varchar](50) NULL,
 [BankActive] [bit] NULL,
 [Createdby] [varchar](50) NULL,
 [Createdon] [datetime] NULL,
 CONSTRAINT [PK_Banks] PRIMARY KEY CLUSTERED
 [Bankid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
Groupmembers
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[GroupMembers](
 [GroupMemberid] [int] IDENTITY(1,1) NOT NULL,
 [Groupid] [int] NOT NULL,
 [BAID] [int] NOT NULL,
 [Createdby] [varchar](50) NULL,
 [Createdon] [datetime] NULL,
 CONSTRAINT [PK_GroupMembers] PRIMARY KEY CLUSTERED
 [GroupMemberid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[GroupMembers]  WITH CHECK ADD  CONSTRAINT [FK_GroupMembers_BankAccounts] FOREIGN KEY([BAID])
REFERENCES [dbo].[BankAccounts] ([BAID])
GO
ALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_BankAccounts]
GO
ALTER TABLE [dbo].[GroupMembers]  WITH CHECK ADD  CONSTRAINT [FK_GroupMembers_Groups] FOREIGN KEY([Groupid])
REFERENCES [dbo].[Groups] ([Groupid])
GO
ALTER TABLE [dbo].[GroupMembers] CHECK CONSTRAINT [FK_GroupMembers_Groups]
BankAccounts
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[BankAccounts](
 [BAID] [int] IDENTITY(1,1) NOT NULL,
 [CustomerID] [int] NOT NULL,
 [Locationid] [varchar](25) NOT NULL,
 [Bankid] [int] NOT NULL,
 [BankAccountNo] [varchar](50) NOT NULL,
 CONSTRAINT [PK_BankAccounts] PRIMARY KEY CLUSTERED
 [BAID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[BankAccounts]  WITH CHECK ADD  CONSTRAINT [FK_BankAccounts_Banks] FOREIGN KEY([Bankid])
REFERENCES [dbo].[Banks] ([Bankid])
GO
ALTER TABLE [dbo].[BankAccounts] CHECK CONSTRAINT [FK_BankAccounts_Banks]
GO
ALTER TABLE [dbo].[BankAccounts]  WITH CHECK ADD  CONSTRAINT [FK_BankAccounts_Locations1] FOREIGN KEY([Locationid])
REFERENCES [dbo].[Locations] ([Locationid])
GO
ALTER TABLE [dbo].[BankAccounts] CHECK CONSTRAINT [FK_BankAccounts_Locations1]
Currency
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Currency](
 [Currencyid] [int] IDENTITY(1,1) NOT NULL,
 [CurrencyISOCode] [varchar](20) NOT NULL,
 [CurrencyCountry] [varchar](50) NULL,
 [Currency] [varchar](50) NULL,
 CONSTRAINT [PK_Currency] PRIMARY KEY CLUSTERED
 [Currencyid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
CurrencyDetails
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[CurrencyDetails](
 [CurDenid] [int] IDENTITY(1,1) NOT NULL,
 [Currencyid] [int] NOT NULL,
 [Denomination] [decimal](15, 3) NOT NULL,
 [DenominationType] [varchar](25) NOT NULL,
 CONSTRAINT [PK_CurrencyDetails] PRIMARY KEY CLUSTERED
 [CurDenid] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
QUERY
WITH TEMP_TABLE AS
SELECT     0 AS COINS, BHDCollectionsDet.Quantity AS BN, BHDCollections.BHDDate AS CollectionDate, BHDCollectionsDet.Currencyid,
                      (BHDCollections.BHDCollectionid) AS DSLIPS, Banks.Bankname
FROM         BHDCollections INNER JOIN
                      BHDCollectionsDet ON BHDCollections.BHDCollectionid = BHDCollectionsDet.BHDCollectionid INNER JOIN
                      GroupMembers ON BHDCollections.GroupMemberid = GroupMembers.GroupMemberid INNER JOIN
                      BankAccounts ON GroupMembers.BAID = BankAccounts.BAID INNER JOIN
                      Currency ON BHDCollectionsDet.Currencyid = Currency.Currencyid INNER JOIN
                      CurrencyDetails ON Currency.Currencyid = CurrencyDetails.Currencyid INNER JOIN
                      Banks ON BankAccounts.Bankid = Banks.Bankid
GROUP BY BHDCollectionsDet.Quantity, BHDCollections.BHDDate, BankAccounts.Bankid, BHDCollectionsDet.Currencyid, CurrencyDetails.DenominationType,
                      CurrencyDetails.Denomination, BHDCollectionsDet.Denomination, Banks.Bankname,BHDCollections.BHDCollectionid
HAVING      (BHDCollections.BHDDate BETWEEN @FromDate AND @ToDate) AND (BankAccounts.Bankid = @Bankid) AND (CurrencyDetails.DenominationType = 'Currency') AND
                      (CurrencyDetails.Denomination = BHDCollectionsDet.Denomination)
UNION ALL
SELECT     BHDCollectionsDet.Quantity AS COINS, 0 AS BN, BHDCollections.BHDDate AS CollectionDate, BHDCollectionsDet.Currencyid,
                      (BHDCollections.BHDCollectionid) AS DSLIPS, Banks.Bankname
FROM         BHDCollections INNER JOIN
                      BHDCollectionsDet ON BHDCollections.BHDCollectionid = BHDCollectionsDet.BHDCollectionid INNER JOIN
                      GroupMembers ON BHDCollections.GroupMemberid = GroupMembers.GroupMemberid INNER JOIN
                      BankAccounts ON GroupMembers.BAID = BankAccounts.BAID INNER JOIN
                      Currency ON BHDCollectionsDet.Currencyid = Currency.Currencyid INNER JOIN
                      CurrencyDetails ON Currency.Currencyid = CurrencyDetails.Currencyid INNER JOIN
                      Banks ON BankAccounts.Bankid = Banks.Bankid
GROUP BY BHDCollectionsDet.Quantity, BHDCollections.BHDDate, BankAccounts.Bankid, BHDCollectionsDet.Currencyid, CurrencyDetails.DenominationType,
                      CurrencyDetails.Denomination, BHDCollectionsDet.Denomination, Banks.Bankname,BHDCollections.BHDCollectionid
HAVING      (BHDCollections.BHDDate BETWEEN @FromDate AND @ToDate) AND (BankAccounts.Bankid = @Bankid) AND (CurrencyDetails.DenominationType = 'COIN') AND
                      (CurrencyDetails.Denomination = BHDCollectionsDet.Denomination)),
TEMP_TABLE2 AS
SELECT CollectionDate,Bankname,DSLIPS AS DSLIPS,SUM(BN) AS BN,SUM(COINS)AS COINS  FROM TEMP_TABLE Group By CollectionDate,DSLIPS,Bankname
SELECT CollectionDate,Bankname,count(DSLIPS) AS DSLIPS,sum(BN) AS BN,sum(COINS) AS coins FROM TEMP_TABLE2 Group By CollectionDate,Bankname
HAVING COUNT(DSLIPS)<>0;

Without seeing an execution plan of the query it is hard to suggest something useful. Try insert the result of UNION ALL to the temporary table and then perform an aggregation on that table, not a CTE.
Just
SELECT CollectionDate,Bankname,DSLIPS AS DSLIPS,SUM(BN) AS BN,SUM(COINS)AS COINS  FROM
#tmp Group By CollectionDate,DSLIPS,Bankname
HAVING COUNT(DSLIPS)<>0;
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • This query is taking a long time:

    Hi All,
    I need help in tuning this query. The stats are as below:
    SQL> show parameter user_dump_dest
    NAME                                 TYPE        VALUE
    user_dump_dest                       string      /opt/app/oracle/diag/rdbms/ebi
                                                     zfile/EBIZFILE/trace
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.2.0.2
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUE
    SQL> show parameter db_file_multi
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     128
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>
    SQL> select
      2  sname, pname, pval1, pval2
      3  from
      4  sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          11-03-2009 02:33
    SYSSTATS_INFO        DSTOP                           11-03-2009 02:33
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW            714.19791
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.
    Elapsed: 00:00:00.03
    SQL>
    SQL> explain plan for
      2   SELECT   A.TRANS_NO,
      3            A.TRANS_ID,
      4            A.REQUEST_IND,
      5            A.TRANS_STATUS_IND,
      6            A.TRANS_STATUS_DATE,
      7            A.DELIVERY_DATE,
      8            C.EMAIL_ADDR
      9        FROM     IIS_TRANS_MASTER A, M_TRANS B, IIS_REQUEST_TRANS C
    10       WHERE
    11             C.TRANS_NO = A.TRANS_NO
    12            AND A.TRANS_STATUS_IND = 'P'
    13            AND A.TRANS_ID = B.TRANS_ID
    14            AND A.TRANS_ID <> 'I009'
    15            AND A.TRANS_ID <> 'NPKG'
    16            AND B.TRANS_CO_TYPE = 'I'
    17            AND A.TRANS_ID NOT IN
    18                  ('P012', 'P13B', 'P13C', 'P14B', 'P14C', 'P015')
    19            AND B.DEPT = 'IRD'
    20  ORDER BY     A.CREATED_DATE;
    Explained.
    Elapsed: 00:00:00.01
    SQL>
    SQL> set pagesize 1000;
    SQL> set linesize 170;
    SQL> @/opt/app/oracle/product/11.2.0/rdbms/admin/utlxplp.sql
    SQL> Rem
    SQL> Rem $Header: utlxplp.sql 23-jan-2002.08:55:23 bdagevil Exp $
    SQL> Rem
    SQL> Rem utlxplp.sql
    SQL> Rem
    SQL> Rem Copyright (c) 1998, 2002, Oracle Corporation.     All rights reserved.
    SQL> Rem
    SQL> Rem    NAME
    SQL> Rem      utlxplp.sql - UTiLity eXPLain Parallel plans
    SQL> Rem
    SQL> Rem    DESCRIPTION
    SQL> Rem      script utility to display the explain plan of the last explain plan
    SQL> Rem      command. Display also Parallel Query information if the plan happens to
    SQL> Rem      run parallel
    SQL> Rem
    SQL> Rem    NOTES
    SQL> Rem      Assume that the table PLAN_TABLE has been created. The script
    SQL> Rem      utlxplan.sql should be used to create that table
    SQL> Rem
    SQL> Rem      With SQL*plus, it is recomended to set linesize and pagesize before
    SQL> Rem      running this script. For example:
    SQL> Rem      set linesize 130
    SQL> Rem      set pagesize 0
    SQL> Rem
    SQL> Rem    MODIFIED   (MM/DD/YY)
    SQL> Rem    bdagevil     01/23/02 - rewrite with new dbms_xplan package
    SQL> Rem    bdagevil     04/05/01 - include CPU cost
    SQL> Rem    bdagevil     02/27/01 - increase Name column
    SQL> Rem    jihuang     06/14/00 - change order by to order siblings by.
    SQL> Rem    jihuang     05/10/00 - include plan info for recursive SQL in LE row source
    SQL> Rem    bdagevil     01/05/00 - make deterministic with order-by
    SQL> Rem    bdagevil     05/07/98 - Explain plan script for parallel plans
    SQL> Rem    bdagevil     05/07/98 - Created
    SQL> Rem
    SQL>
    SQL> set markup html preformat on
    SQL>
    SQL> Rem
    SQL> Rem Use the display table function from the dbms_xplan package to display the last
    SQL> Rem explain plan. Use default mode which will display only relevant information
    SQL> Rem
    SQL> select * from table(dbms_xplan.display());
    PLAN_TABLE_OUTPUT
    Plan hash value: 3822676895
    | Id  | Operation                      | Name              | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                   | 38075 |  3123K|       | 22550   (2)| 00:04:31 |
    |   1 |  SORT ORDER BY                 |                   | 38075 |  3123K|  3472K| 22550   (2)| 00:04:31 |
    |*  2 |   HASH JOIN                    |                   | 38075 |  3123K|  2120K| 21801   (2)| 00:04:22 |
    |   3 |    NESTED LOOPS                |                   |       |       |       |            |          |
    |   4 |     NESTED LOOPS               |                   | 38075 |  1673K|       |  4177   (1)| 00:00:51 |
    |*  5 |      TABLE ACCESS FULL         | M_TRANS           |    10 |    80 |       |     7   (0)| 00:00:01 |
    |*  6 |      INDEX RANGE SCAN          | IDX_IIS_TRANS_ID  | 39401 |       |       |   109   (3)| 00:00:02 |
    |*  7 |     TABLE ACCESS BY INDEX ROWID| IIS_TRANS_MASTER  |  3940 |   142K|       |  3186   (1)| 00:00:39 |
    |   8 |    TABLE ACCESS FULL           | IIS_REQUEST_TRANS |  2114K|    78M|       | 12368   (2)| 00:02:29 |
    Predicate Information (identified by operation id):
       2 - access("C"."TRANS_NO"="A"."TRANS_NO")
       5 - filter("B"."DEPT"='IRD' AND "B"."TRANS_CO_TYPE"='I' AND "B"."TRANS_ID"<>'I009' AND
                  "B"."TRANS_ID"<>'NPKG' AND "B"."TRANS_ID"<>'P012' AND "B"."TRANS_ID"<>'P13B' AND
                  "B"."TRANS_ID"<>'P13C' AND "B"."TRANS_ID"<>'P14B' AND "B"."TRANS_ID"<>'P14C' AND
                  "B"."TRANS_ID"<>'P015')
       6 - access("A"."TRANS_ID"="B"."TRANS_ID")
           filter("A"."TRANS_ID"<>'I009' AND "A"."TRANS_ID"<>'NPKG' AND "A"."TRANS_ID"<>'P012' AND
                  "A"."TRANS_ID"<>'P13B' AND "A"."TRANS_ID"<>'P13C' AND "A"."TRANS_ID"<>'P14B' AND
                  "A"."TRANS_ID"<>'P14C' AND "A"."TRANS_ID"<>'P015')
       7 - filter("A"."TRANS_STATUS_IND"='P')
    29 rows selected.
    Elapsed: 00:00:00.02
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.00
    SQL>
    SQL> rem Set the ARRAYSIZE according to your application
    SQL> set autotrace traceonly arraysize 100
    SQL>
    SQL> alter session set tracefile_identifier = 'mytrace1';
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    SQL> rem if you're using bind variables
    SQL> rem define them here
    SQL>
    SQL> rem variable b_var1 number
    SQL> rem variable b_var2 varchar2(20)
    SQL>
    SQL> rem and initialize them
    SQL>
    SQL> rem exec :b_var1 := 1
    SQL> rem exec :b_var2 := 'DIAG'
    SQL> set pagesize 1000;
    SQL> set linesize 170;
    SQL> alter session set events '10046 trace name context forever, level 8';
    Session altered.
    Elapsed: 00:00:00.00
    SQL>  SELECT   A.TRANS_NO,
      2            A.TRANS_ID,
      3            A.REQUEST_IND,
      4            A.TRANS_STATUS_IND,
      5            A.TRANS_STATUS_DATE,
      6            A.DELIVERY_DATE,
      7            C.EMAIL_ADDR
      8        FROM     IIS_TRANS_MASTER A, M_TRANS B, IIS_REQUEST_TRANS C
      9       WHERE
    10             C.TRANS_NO = A.TRANS_NO
    11            AND A.TRANS_STATUS_IND = 'P'
    12            AND A.TRANS_ID = B.TRANS_ID
    13            AND A.TRANS_ID <> 'I009'
    14            AND A.TRANS_ID <> 'NPKG'
    15            AND B.TRANS_CO_TYPE = 'I'
    16            AND A.TRANS_ID NOT IN
    17                  ('P012', 'P13B', 'P13C', 'P14B', 'P14C', 'P015')
    18            AND B.DEPT = 'IRD'
    19  ORDER BY     A.CREATED_DATE;
    19 rows selected.
    Elapsed: 00:00:15.44
    Execution Plan
    Plan hash value: 3822676895
    | Id  | Operation                      | Name              | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                   | 38075 |  3123K|       | 22550   (2)| 00:04:31 |
    |   1 |  SORT ORDER BY                 |                   | 38075 |  3123K|  3472K| 22550   (2)| 00:04:31 |
    |*  2 |   HASH JOIN                    |                   | 38075 |  3123K|  2120K| 21801   (2)| 00:04:22 |
    |   3 |    NESTED LOOPS                |                   |       |       |       |            |          |
    |   4 |     NESTED LOOPS               |                   | 38075 |  1673K|       |  4177   (1)| 00:00:51 |
    |*  5 |      TABLE ACCESS FULL         | M_TRANS           |    10 |    80 |       |     7   (0)| 00:00:01 |
    |*  6 |      INDEX RANGE SCAN          | IDX_IIS_TRANS_ID  | 39401 |       |       |   109   (3)| 00:00:02 |
    |*  7 |     TABLE ACCESS BY INDEX ROWID| IIS_TRANS_MASTER  |  3940 |   142K|       |  3186   (1)| 00:00:39 |
    |   8 |    TABLE ACCESS FULL           | IIS_REQUEST_TRANS |  2114K|    78M|       | 12368   (2)| 00:02:29 |
    Predicate Information (identified by operation id):
       2 - access("C"."TRANS_NO"="A"."TRANS_NO")
       5 - filter("B"."DEPT"='IRD' AND "B"."TRANS_CO_TYPE"='I' AND "B"."TRANS_ID"<>'I009' AND
                  "B"."TRANS_ID"<>'NPKG' AND "B"."TRANS_ID"<>'P012' AND "B"."TRANS_ID"<>'P13B' AND
                  "B"."TRANS_ID"<>'P13C' AND "B"."TRANS_ID"<>'P14B' AND "B"."TRANS_ID"<>'P14C' AND
                  "B"."TRANS_ID"<>'P015')
       6 - access("A"."TRANS_ID"="B"."TRANS_ID")
           filter("A"."TRANS_ID"<>'I009' AND "A"."TRANS_ID"<>'NPKG' AND "A"."TRANS_ID"<>'P012' AND
                  "A"."TRANS_ID"<>'P13B' AND "A"."TRANS_ID"<>'P13C' AND "A"."TRANS_ID"<>'P14B' AND
                  "A"."TRANS_ID"<>'P14C' AND "A"."TRANS_ID"<>'P015')
       7 - filter("A"."TRANS_STATUS_IND"='P')
    Statistics
             23  recursive calls
              0  db block gets
         164826  consistent gets
          74235  physical reads
              0  redo size
           1839  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             19  rows processed
    SQL>
    SQL> disconnect
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    Hi Manik,
    1) Not really. Order by may not be required.
    2) After gathering the stats, below is the result:
    NAME_COL_PLUS_SHOW_PARAM                                                         TYPE
    VALUE_COL_PLUS_SHOW_PARAM
    user_dump_dest                                                                   string
    /opt/app/oracle/diag/rdbms/ebizfile/EBIZFILE/trace
    SQL> show parameter optimizer
    NAME_COL_PLUS_SHOW_PARAM                                                         TYPE
    VALUE_COL_PLUS_SHOW_PARAM
    Elapsed: 00:00:00.05
    SQL>  SELECT   A.TRANS_NO,
      2            A.TRANS_ID,
      3            A.REQUEST_IND,
      4            A.TRANS_STATUS_IND,
      5            A.TRANS_STATUS_DATE,
      6            A.DELIVERY_DATE,
      7            C.EMAIL_ADDR
      8        FROM     IIS_TRANS_MASTER A, M_TRANS B, IIS_REQUEST_TRANS C
      9       WHERE
    10             C.TRANS_NO = A.TRANS_NO
    11            AND A.TRANS_STATUS_IND = 'P'
    12            AND A.TRANS_ID = B.TRANS_ID
    13            AND A.TRANS_ID <> 'I009'
    14            AND A.TRANS_ID <> 'NPKG'
    15            AND B.TRANS_CO_TYPE = 'I'
    16            AND A.TRANS_ID NOT IN
    17                  ('P012', 'P13B', 'P13C', 'P14B', 'P14C', 'P015')
    18            AND B.DEPT = 'IRD'
    19  ORDER BY     A.CREATED_DATE;
    20 rows selected.
    Elapsed: 00:00:06.58
    Execution Plan
    Plan hash value: 3822676895
    | Id  | Operation                      | Name              | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                   | 38091 |  3124K|       | 22553   (2)| 00:04:31 |
    |   1 |  SORT ORDER BY                 |                   | 38091 |  3124K|  3472K| 22553   (2)| 00:04:31 |
    |*  2 |   HASH JOIN                    |                   | 38091 |  3124K|  2128K| 21804   (2)| 00:04:22 |
    |   3 |    NESTED LOOPS                |                   |       |       |       |            |          |
    |   4 |     NESTED LOOPS               |                   | 38091 |  1673K|       |  4180   (1)| 00:00:51 |
    |*  5 |      TABLE ACCESS FULL         | M_TRANS           |    10 |    80 |       |     7   (0)| 00:00:01 |
    |*  6 |      INDEX RANGE SCAN          | IDX_IIS_TRANS_ID  | 39418 |       |       |   109   (3)| 00:00:02 |
    |*  7 |     TABLE ACCESS BY INDEX ROWID| IIS_TRANS_MASTER  |  3942 |   142K|       |  3189   (1)| 00:00:39 |
    |   8 |    TABLE ACCESS FULL           | IIS_REQUEST_TRANS |  2114K|    78M|       | 12368   (2)| 00:02:29 |
    Predicate Information (identified by operation id):
       2 - access("C"."TRANS_NO"="A"."TRANS_NO")
       5 - filter("B"."DEPT"='IRD' AND "B"."TRANS_CO_TYPE"='I' AND "B"."TRANS_ID"<>'I009' AND
                  "B"."TRANS_ID"<>'NPKG' AND "B"."TRANS_ID"<>'P012' AND "B"."TRANS_ID"<>'P13B' AND
                  "B"."TRANS_ID"<>'P13C' AND "B"."TRANS_ID"<>'P14B' AND "B"."TRANS_ID"<>'P14C' AND
                  "B"."TRANS_ID"<>'P015')
       6 - access("A"."TRANS_ID"="B"."TRANS_ID")
           filter("A"."TRANS_ID"<>'I009' AND "A"."TRANS_ID"<>'NPKG' AND "A"."TRANS_ID"<>'P012' AND
                  "A"."TRANS_ID"<>'P13B' AND "A"."TRANS_ID"<>'P13C' AND "A"."TRANS_ID"<>'P14B' AND
                  "A"."TRANS_ID"<>'P14C' AND "A"."TRANS_ID"<>'P015')
       7 - filter("A"."TRANS_STATUS_IND"='P')
    Statistics
             17  recursive calls
              0  db block gets
         158643  consistent gets
          49083  physical reads
              0  redo size
           1917  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             20  rows processedI am yet to try the DBMS_SQLTUNE.
    Are you able to give me in simplified form the steps in executing this query for the DBMS_SQLTUNE? Thanks!

  • Aso cube build is taking very long time than expected.

    Hi all,
    We have 3 essbase servers (100v, 100x and 100y). No issue with 100y server.
    - 100v and 100x are mirror servers (i.e. same cubes will be built and load onto 100x after 100v is done)
    - Initially ASO build of a cube on 100v used to take 40 mins and on 100x takes 1hr 15mins(approx).
    - But now it is taking 3 hours on 100v. But 100x is still ok (same as before).
    - Note: This is happening for only aso build and data load only on 100v(we load data into aso cubes).
    please let meknow if any ideas. also let m know if more info needed.
    Thanks,
    KK

    KK wrote:
    Hi all,
    We have 3 essbase servers (100v, 100x and 100y). No issue with 100y server.
    - 100v and 100x are mirror servers (i.e. same cubes will be built and load onto 100x after 100v is done)
    - Initially ASO build of a cube on 100v used to take 40 mins and on 100x takes 1hr 15mins(approx).
    - But now it is taking 3 hours on 100v. But 100x is still ok (same as before).
    - Note: This is happening for only aso build and data load only on 100v(we load data into aso cubes).
    please let meknow if any ideas. also let m know if more info needed.
    Thanks,
    KKPlease check any other process is occupying the space while Building or loading data in 100v server...Check Usage of CPU memory through taskmanager...
    If any process is taking much memory except esssvr.exe and essbase.exe....just terminate it...and check
    and it is also depends on the servers configuration....100v & 100x should be same as 100Y....
    Edited by: Prabhas on Sep 27, 2011 12:19 PM

  • Why are my apps taking a long time to update both on my phone and iPad?

    Why are my apps taking a long time to update both on my phone and iPad?

    Hi ariasm21,
    Thanks for visiting Apple Support Communities.
    If the App Store on your iPhone seems unresponsive or app updates are not completing, try the steps below.
    First force close the apps using these steps:
    Double-click the Home button.
    Swipe left or right until you have located the app you wish to close.
    Swipe the app's preview up to close it.
    These steps come from this article:
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    Next, restart your device:
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/ht1430
    Try updating an app again. If the issues persist, you may want to troubleshoot your internet connection next:
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/kb/ts1398
    All the best,
    Jeremy

  • When query is taking too long time

    When query is taking too long time,Where and how to start tuning it?
    Here i've listed few things need to be considered,out of my knowledge and understanding
    1.What the sql is waiting for(wait events)
    2.Parameter modification need to be done at system/session level
    3.The query has to be tuned (using hints )
    4.Gathering/deleting statistics
    List out any other things that need to be taken into account?
    Which approach must be followed and on what basis that approach must be considered?

    When query is taking too long time,Where and how to start tuning it?explain plan will be good start . trace also
    Here i've listed few things need to be considered,out of my knowledge and understanding
    1.What the sql is waiting for(wait events)When Oracle executes an SQL statement, it is not constantly executing. Sometimes it has to wait for a specific event to happen befor it can proceed.
    Read
    http://www.adp-gmbh.ch/ora/tuning/event.html
    2.Parameter modification need to be done at system/session levelDepend on parameter , define parameter , trace done on session level for example
    3.The query has to be tuned (using hints )Could be help you but you must know how to use .
    4.Gathering/deleting statisticsDo it in non working hours , it will impact on database performance , but its good
    List out any other things that need to be taken into account?Which account ?
    Which approach must be followed and on what basis that approach must be considered?you could use lot of tools , Trace , AWR

  • TS3276 When I send an email no matter how small it now seems to take a much longer time than usual (by watching the gear wheel spinning). Anyone have any ideas how I can get my sending back to a much shorter time?

    When I send an email no matter how small it now seems to take a much longer time than usual (by watching the gear wheel spinning). Anyone have any ideas how I can get my sending back to a much shorter time?

    Have you burned Discs with other programs using this computer? Are you certain that you have a drive that will burn discs?

  • Oracle SQL Select query takes long time than expected.

    Hi,
    I am facing a problem in SQL select query statement. There is a long time taken in select query from the Database.
    The query is as follows.
    select /*+rule */ f1.id,f1.fdn,p1.attr_name,p1.attr_value from fdnmappingtable f1,parametertable p1 where p1.id = f1.id and ((f1.object_type ='ne_sub_type.780' )) and ( (f1.id in(select id from fdnmappingtable where fdn like '0=#1#/14=#S0058-3#/17=#S0058-3#/18=#1#/780=#5#%')))order by f1.id asc
    This query is taking more than 4 seconds to get the results in a system where the DB is running for more than 1 month.
    The same query is taking very few milliseconds (50-100ms) in a system where the DB is freshly installed and the data in the tables are same in both the systems.
    Kindly advice what is going wrong??
    Regards,
    Purushotham

    SQL> @/alcatel/omc1/data/query.sql
    2 ;
    9 rows selected.
    Execution Plan
    Plan hash value: 3745571015
    | Id | Operation | Name |
    | 0 | SELECT STATEMENT | |
    | 1 | SORT ORDER BY | |
    | 2 | NESTED LOOPS | |
    | 3 | NESTED LOOPS | |
    | 4 | TABLE ACCESS FULL | PARAMETERTABLE |
    |* 5 | TABLE ACCESS BY INDEX ROWID| FDNMAPPINGTABLE |
    |* 6 | INDEX UNIQUE SCAN | PRIMARY_KY_FDNMAPPINGTABLE |
    |* 7 | TABLE ACCESS BY INDEX ROWID | FDNMAPPINGTABLE |
    |* 8 | INDEX UNIQUE SCAN | PRIMARY_KY_FDNMAPPINGTABLE |
    Predicate Information (identified by operation id):
    5 - filter("F1"."OBJECT_TYPE"='ne_sub_type.780')
    6 - access("P1"."ID"="F1"."ID")
    7 - filter("FDN" LIKE '0=#1#/14=#S0058-3#/17=#S0058-3#/18=#1#/780=#5#
    8 - access("F1"."ID"="ID")
    Note
    - rule based optimizer used (consider using cbo)
    Statistics
    0 recursive calls
    0 db block gets
    0 consistent gets
    0 physical reads
    0 redo size
    0 bytes sent via SQL*Net to client
    0 bytes received via SQL*Net from client
    0 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    9 rows processed
    SQL>

  • Why is this video render taking a long time?

    OS X Mavericks, Photoshop cc 2014, 2011 core i7 3.4 imac with 32GB ram, 256GB ssd scratch disk, 2GB video card.
    See images for layers setup, etc., and for export settings. Each 'slide' is a jpeg under a MB placed as smart object. Each lower third is about 2 MB placed as smart object.
    Render takes about 24 hours to complete. Why is this taking so long? I've tried this on other machines but they all take about the same time. Is there a better way to do this? Thanks, in advance, for your help!

    How long are the video clips and I see on at least one you have added a camera raw smart filter.   I do not know how a smart filter operates on a video clip. However if Photoshop need to renter a full frame for each video frame and filter each frame image with ACR then  encode the frames into a mp4 video stream it could be a very time consuming process  for nearly 170 thousand frames.  Have you tried encoding the mp4 without using the ACR smart filter adjustment? You also do not show the Timeline palette.

  • Why Safari takes much long time than other browser to open a page?

    I have used windows since start of my computing life... Now i have replaced my windows laptop to a macbook pro.. Everything is amazing.. except only one. Safari.. I experience it takes too long time for openning a webpage...even for a simple webpage...takes much more time for loading a flash... I dont know why Safari is taking too many times as compared to other web browsers...

    I found the same problem too after moving into mac earlier this week....
    i guess here's the solution https://discussions.apple.com/thread/5227588
    try uninstall/unable the third party extension

  • Connect by level query is taking too long time to run

    Hello,
    I have a query that returns quarters (YYYYQ) of a begin- and enddate within a specific id, that is built with a connect by level clause, but the query is running to long. I have used explain plan to see what the query is doing, but no silly things to see, just a full table scan, with low costs.
    This is the query:
    select to_char(add_months( cpj.crpj_start_date,3*(level - 1)),'YYYYQ') as sales_quarter
    , cpj.crpj_id as crpj_id
    from mv_gen_cra_projects cpj
    where cpj.crpj_start_date >= to_date('01/01/2009','mm/dd/yyyy')
    and cpj.crpj_start_date <= cpj.crpj_end_date
    and cpj.crpj_routing_type = 'A'
    and ( cpj.crpj_multi_artist_ind = 'N'
    or cpj.crpj_multi_artist_ind is null)
    connect by level <= 1 + ceil(months_between(cpj.crpj_end_date,cpj.crpj_start_date)/3);
    The result have to be like this:
    SALES_QUARTER CRPJ_ID
    20091 100
    20092 100
    20093 100
    20094 100
    20101 100
    20102 100
    Can anyone help me out with this?

    but no silly things to see, just a full table scan, with low costs.Well, maybe an index scan would be faster?
    However:
    You will need to provide us some more details, like:
    - database version (the result of: SQL> select * from v$version;)
    - post the explain plan output (put the tag before and after it, so indentation and formatting are maintained, see the [FAQ|http://forums.oracle.com/forums/help.jspa] for more explanation regarding tags )
    - what are your optimizer settings (the result of: SQL> show parameter optimizer)
    - if applicable: are your table statistics up to date?
    - mv_gen_cra_projects  is a materialized view perhaps?
    Edited by: hoek on Jan 26, 2010 10:50 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • OR is taking much more time than UNION

    hi gems..
    i have written a query using UNION clause and it took 12 seconds to give result.
    then i wrote the same query using OR operator and then it took 78 seconds to give the resultset.
    The tables which are referred by this qurey have no indexes.
    the cost plans for the query with OR is also much more lesser than that with UNION.
    please suggest why OR is taking more time.
    thanks in advance

    Here's a ridiculously simple example.  (these tables don't even have any rows in them)
    If you had separate indexes on col1 and col2, the optimizer might use indexes in the union but not in the or statement:
    Which is faster will depend on the usual list of things.
    Of course, the union also requires a sort operation.
    SQL> create table table1
      2  (col1 number, col2 number, col3 number, col4 number);
    Table created.
    SQL> create index t1_idx1 on table1(col1);
    Index created.
    SQL> create index t1_idx2 on table1(col2);
    Index created.
    SQL> explain plan for
      2  select col1, col2, col3, col4
      3  from table1
      4  where col1> = 123
      5  or col2 <= 456;
    Explained.
    SQL> @xp
    | Id  | Operation         | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |        |     1 |    52 |     2   (0)| 00:00:01 |
    |*  1 |  TABLE ACCESS FULL| TABLE1 |     1 |    52 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("COL1">=123 OR "COL2"<=456)
    SQL> explain plan for
      2  select col1, col2, col3, col4
      3  from table1
      4  where col1 >= 123
      5  union
      6  select col1, col2, col3, col4
      7  from table1
      8  where col2 <= 456;
    Explained.
    SQL> @xp
    | Id  | Operation                     | Name    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT              |         |     2 |   104 |     4  (75)| 00:00:01 |
    |   1 |  SORT UNIQUE                  |         |     2 |   104 |     4  (75)| 00:00:01 |
    |   2 |   UNION-ALL                   |         |       |       |            |          |
    |   3 |    TABLE ACCESS BY INDEX ROWID| TABLE1  |     1 |    52 |     1   (0)| 00:00:01 |
    |*  4 |     INDEX RANGE SCAN          | T1_IDX1 |     1 |       |     1   (0)| 00:00:01 |
    |   5 |    TABLE ACCESS BY INDEX ROWID| TABLE1  |     1 |    52 |     1   (0)| 00:00:01 |
    |*  6 |     INDEX RANGE SCAN          | T1_IDX2 |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - access("COL1">=123)
       6 - access("COL2"<=456)

  • Cursor taking much longer time

    Is there any solution to optimize this? As it is taking more than 2 hours to update the table.
    Stats about the table records count:
    table_1 = 0.3milliions
    table_2 = 89k
    table_3 = 2.5 millions
    table_4 = 6k
    =========================================
    cursor c1 is
    SELECT SUM (A.w_amount) AS total_comp, D.emp_no
    FROM table_1 A,
    table_2 B,
    table_3 C,
    table_4 D
    WHERE A.emp_no = B.emp_no
    AND A.check_id = B.check_id
    AND A.emp_no = C.emp_no
    AND D.emp_no = C.emp_no
    AND A.earn_code IN ('REM')
    AND B.check_date >= C.elig_dt
    AND ee.time_s_key = user2.time_pkg.fx_time_key()
    GROUP BY D.emp_no;
    BEGIN
    FOR cur_row IN c1
    LOOP
    UPDATE table_4
    SET gross_comp = cur_row.total_comp
    WHERE cur_row.emp_no = table_4.emp_no;
    END LOOP;
    END;
    ======================================

    time_key_var := user2.time_pkg.fx_time_key();
    update table_4 D
    set gross_comp = (
    SELECT SUM (A.w_amount) AS total_comp, D.emp_no
    FROM table_1 A,
    table_2 B,
    table_3 C
    WHERE A.emp_no = B.emp_no
    AND A.check_id = B.check_id
    AND A.emp_no = C.emp_no
    AND D.emp_no = C.emp_no
    AND A.earn_code IN ('REM')
    AND B.check_date >= C.elig_dt
    AND ee.time_s_key = time_key_var
    GROUP BY D.emp_no
    where exists (
    SELECT null
    FROM table_1 A,
    table_2 B,
    table_3 C
    WHERE A.emp_no = B.emp_no
    AND A.check_id = B.check_id
    AND A.emp_no = C.emp_no
    AND D.emp_no = C.emp_no
    AND A.earn_code IN ('REM')
    AND B.check_date >= C.elig_dt
    AND ee.time_s_key = time_key_var
    );

  • Query on Cube jumps to Query on ODS ; Query on ODS takes Long time

    Hi All,
    Perormance Issue:  Query on Cube jumps to Query on ODS.
    Query on ODS taking long time.(JumpQuery)  
    Specific to ODS Query: When i have checked the Query on ODS(individually) also taking longer time
    Actually ODS contains quite huge data. Indexes already maintained.
    I have checked the RSRT- Execute SQL and Debug Option also. Indexes maintained Perfectly .
    Order of objects in ODS indexes are matching the order of Objects in SQL stat of RSRT Trans. Inspite of that taking long time.
    I have checked both the ways jumpquery aswellas individually .
    My question is when the query is jumping from cube to query on ODS how to check the performance, how the query is executing in background when switching over to the second query, Moreover calculated keyfigure has been used for jumping to the target query.
    How can query(ods query)  time is optimized or improve performance when jumping  from query on Cube ?
    can any body help?
    Rgds,
    C.V.
    Message was edited by:
            C.V. P

    What i understand is that you need to optimise the Query jumping time . But this will be very less compared to the time taken by the query on the ODS.
    Ideally you shouldnt be making a BEx Query on the ODS , as this takes a long time. What you can do is try executing the Bex Query on the ODS to find out as to where the issue lies. If this query is taking a long time , there is not muich that you can do here.

  • Hyperion Report taking a long time to process local query

    Hi All,
    I am trying to run a report on Hyperion IR 9.3.1. I am facing a performance issue with this report. I am joining 13 tables using full outer join. Each table is having data about 900 rows and the final output i am getting from the local query is about 11000 rows. This local query is taking a long time to get process about 3 - 5 minutes. I suppose it should run with in 30 sec as number of rows are very few. Can anyone tell me what is the problem with this local query and how the performance of the report can be increased?
    Thanks in advance.
    Regards
    Ujjawal

    Be aware that XP takes approx 1gb of your RAM leaving you with 1gb for whatever else is running. MS Outlook is also a memory hog.
    To check Virtual Memory Settings:
    Control Panel -> System
    System Properties -> Advanced Tab -> Performance Settings
    Performance Options -> Adavanced Tab - Virtual Memory section
    Virtual Memory -
    what are
    * Initial Size
    * Maximum Size
    In a presentation at one of the Hyperion conferences years ago, Mark Ostroff suggested that the initial be set to the same as Max. (Max is typically 2x physical RAM)
    These changes may provide some improvement.

  • Query taking very long time

    DB 11.2.0.3.4
    Server HP-UX IA 11.31
    One big query is taking very long time. I am giving the explain plan along with stats from tkprof. If needed will give the query also. Can sombody tell me how can we improve this.
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1     23.26      23.90          0         20          0           0
    Execute      1   8055.11    9453.52     684215     348696   18750740     1306001
    Fetch        0      0.00       0.00          0          0          0           0
    total        2   8078.37    9477.42     684215     348716   18750740     1306001
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 322  (EDW_DM)   (recursive depth: 1)
    Rows     Row Source Operation
          0  LOAD TABLE CONVENTIONAL  (cr=352254 pr=684215 pw=682074 time=863655932 us)
    1306001   PX COORDINATOR  (cr=15823 pr=682074 pw=682074 time=499947892 us)
          0    PX SEND QC (RANDOM) :TQ20004 (cr=0 pr=0 pw=0 time=0 us cost=276195 size=126736955032 card=9998182)
          0     BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0      VIEW  VW_FCT_PLN_SUMM_ADL_WK_XARH317 (cr=0 pr=0 pw=0 time=0 us cost=276195 size=126736955032 card=9998182)
          0       UNION-ALL  (cr=0 pr=0 pw=0 time=0 us)
          0        SORT GROUP BY (cr=0 pr=0 pw=0 time=0 us cost=9167 size=95469948 card=378849)
          0         PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=9167 size=95469948 card=378849)
          0          PX SEND HASH :TQ20003 (cr=0 pr=0 pw=0 time=0 us cost=9167 size=95469948 card=378849)
          0           SORT GROUP BY (cr=0 pr=0 pw=0 time=0 us cost=9167 size=95469948 card=378849)
          0            HASH JOIN RIGHT SEMI (cr=0 pr=0 pw=0 time=0 us cost=2714 size=95469948 card=378849)
          0             BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0              PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=26 size=16428 card=4107)
          0               PX SEND BROADCAST :TQ20000 (cr=0 pr=0 pw=0 time=0 us cost=26 size=16428 card=4107)
       4857                VIEW  VW_SQ_1 (cr=47 pr=0 pw=0 time=25403 us cost=26 size=16428 card=4107)
       4857                 HASH JOIN  (cr=47 pr=0 pw=0 time=23353 us cost=26 size=229992 card=4107)
       1115                  TABLE ACCESS FULL DMN_PROD (cr=11 pr=0 pw=0 time=863 us cost=6 size=13380 card=1115)
       4873                  HASH JOIN  (cr=36 pr=0 pw=0 time=12991 us cost=20 size=180840 card=4110)
         55                   TABLE ACCESS FULL DMN_MKT_DEFN (cr=3 pr=0 pw=0 time=286 us cost=4 size=1980 card=55)
      18235                   TABLE ACCESS FULL FCT_MKT_PROD_BRDG (cr=33 pr=0 pw=0 time=13550 us cost=15 size=145880 card=18235)
          0             HASH JOIN  (cr=0 pr=0 pw=0 time=0 us cost=2686 size=93954552 card=378849)
          0              BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0               PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
          0                PX SEND BROADCAST :TQ20001 (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
       8768                 NESTED LOOPS  (cr=274 pr=0 pw=0 time=15077 us cost=111 size=403328 card=8768)
          1                  NESTED LOOPS  (cr=5 pr=0 pw=0 time=203 us cost=5 size=28 card=1)
          1                   TABLE ACCESS FULL DMN_WK_END (cr=2 pr=0 pw=0 time=81 us cost=3 size=8 card=1)
          1                   TABLE ACCESS BY INDEX ROWID DMN_CALN (cr=3 pr=0 pw=0 time=110 us cost=2 size=20 card=1)
          1                    INDEX RANGE SCAN XNU1_DMN_CALN (cr=2 pr=0 pw=0 time=73 us cost=1 size=0 card=1)(object id 303867)
       8768                  TABLE ACCESS FULL DMN_CALN (cr=269 pr=0 pw=0 time=11719 us cost=106 size=157824 card=8768)
          0              PX BLOCK ITERATOR PARTITION: KEY KEY (cr=0 pr=0 pw=0 time=0 us cost=2573 size=76527498 card=378849)
          0               TABLE ACCESS FULL FCT_NONRET_SLS_CURR_TRANS_WKLY PARTITION: 32 32 (cr=0 pr=0 pw=0 time=0 us cost=2573 size=76527498 card=378849)
          0        BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0         PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=267028 size=2741509905 card=9619333)
          0          PX SEND ROUND-ROBIN :TQ20002 (cr=0 pr=0 pw=0 time=0 us cost=267028 size=2741509905 card=9619333)
    1284599           SORT GROUP BY (cr=15497 pr=682074 pw=682074 time=3839060439 us cost=267028 size=2741509905 card=9619333)
    6439189            FILTER  (cr=15486 pr=0 pw=0 time=57890179 us)
    8986531             PX COORDINATOR  (cr=279 pr=0 pw=0 time=52453034 us)
          0              PX SEND QC (RANDOM) :TQ10001 (cr=0 pr=0 pw=0 time=0 us cost=80940 size=2741509905 card=9619333)
          0               HASH JOIN  (cr=0 pr=0 pw=0 time=0 us cost=80940 size=2741509905 card=9619333)
          0                BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0                 PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
          0                  PX SEND BROADCAST :TQ10000 (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
       8768                   NESTED LOOPS  (cr=274 pr=0 pw=0 time=14462 us cost=111 size=403328 card=8768)
          1                    NESTED LOOPS  (cr=5 pr=0 pw=0 time=345 us cost=5 size=28 card=1)
          1                     TABLE ACCESS FULL DMN_WK_END (cr=2 pr=0 pw=0 time=193 us cost=3 size=8 card=1)
          1                     TABLE ACCESS BY INDEX ROWID DMN_CALN (cr=3 pr=0 pw=0 time=136 us cost=2 size=20 card=1)
          1                      INDEX RANGE SCAN XNU1_DMN_CALN (cr=2 pr=0 pw=0 time=76 us cost=1 size=0 card=1)(object id 303867)
       8768                    TABLE ACCESS FULL DMN_CALN (cr=269 pr=0 pw=0 time=9447 us cost=106 size=157824 card=8768)
          0                PX BLOCK ITERATOR PARTITION: KEY KEY (cr=0 pr=0 pw=0 time=0 us cost=80801 size=2299020587 card=9619333)
          0                 TABLE ACCESS FULL FCT_PLN_RET_SLS_CURR_WKLY PARTITION: 30 30 (cr=0 pr=0 pw=0 time=0 us cost=80801 size=2299020587 card=9619333)
        834             NESTED LOOPS  (cr=15207 pr=0 pw=0 time=990747 us)
       2269              NESTED LOOPS  (cr=12938 pr=0 pw=0 time=1090852 us cost=17 size=56 card=1)
       2269               NESTED LOOPS  (cr=12101 pr=0 pw=0 time=1065238 us cost=16 size=20 card=1)
        834                TABLE ACCESS BY INDEX ROWID DMN_PROD (cr=1676 pr=0 pw=0 time=37175 us cost=1 size=12 card=1)
        838                 INDEX UNIQUE SCAN XPKDIMENSION_PRODUCT (cr=838 pr=0 pw=0 time=23645 us cost=0 size=0 card=1)(object id 303870)
       2269                TABLE ACCESS FULL FCT_MKT_PROD_BRDG (cr=10425 pr=0 pw=0 time=1024973 us cost=15 size=8 card=1)
       2269               INDEX UNIQUE SCAN SYS_C0040182 (cr=837 pr=0 pw=0 time=15842 us cost=0 size=0 card=1)(object id 301873)
        834              TABLE ACCESS BY INDEX ROWID DMN_MKT_DEFN (cr=2269 pr=0 pw=0 time=16488 us cost=1 size=36 card=1)
    It would be appreciated if somebody check this.
    Regards,
    Virendra

    Below is with the index on one of the table:
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1     49.33      49.61          0         16          0           0
    Execute      1   8374.08   10745.82     953712     473861   18818854     1306001
    Fetch        0      0.00       0.00          0          0          0           0
    total        2   8423.41   10795.43     953712     473877   18818854     1306001
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 322     (recursive depth: 1)
    Rows     Row Source Operation
          0  LOAD TABLE CONVENTIONAL  (cr=481416 pr=953712 pw=917687 time=2156047932 us)
    1306001   PX COORDINATOR  (cr=131828 pr=917687 pw=917687 time=1528317728 us)
          0    PX SEND QC (RANDOM) :TQ10004 (cr=0 pr=0 pw=0 time=0 us cost=144212 size=16362383616 card=1290816)
          0     BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0      VIEW  VW_FCT_PLN_SUM_ADL_WK_XRH317_1 (cr=0 pr=0 pw=0 time=0 us cost=144212 size=16362383616 card=1290816)
          0       UNION-ALL  (cr=0 pr=0 pw=0 time=0 us)
          0        SORT GROUP BY (cr=0 pr=0 pw=0 time=0 us cost=9568 size=101394468 card=402359)
          0         PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=9568 size=101394468 card=402359)
          0          PX SEND HASH :TQ10003 (cr=0 pr=0 pw=0 time=0 us cost=9568 size=101394468 card=402359)
          0           SORT GROUP BY (cr=0 pr=0 pw=0 time=0 us cost=9568 size=101394468 card=402359)
          0            HASH JOIN RIGHT SEMI (cr=0 pr=0 pw=0 time=0 us cost=2714 size=101394468 card=402359)
          0             BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0              PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=26 size=16428 card=4107)
          0               PX SEND BROADCAST :TQ10000 (cr=0 pr=0 pw=0 time=0 us cost=26 size=16428 card=4107)
       4857                VIEW  VW_SQ_1 (cr=47 pr=0 pw=0 time=25732 us cost=26 size=16428 card=4107)
       4857                 HASH JOIN  (cr=47 pr=0 pw=0 time=23041 us cost=26 size=229992 card=4107)
       1115                  TABLE ACCESS FULL DMN_PROD (cr=11 pr=0 pw=0 time=1040 us cost=6 size=13380 card=1115)
       4873                  HASH JOIN  (cr=36 pr=0 pw=0 time=12797 us cost=20 size=180840 card=4110)
         55                   TABLE ACCESS FULL DMN_MKT_DEFN (cr=3 pr=0 pw=0 time=185 us cost=4 size=1980 card=55)
      18235                   TABLE ACCESS FULL FCT_MKT_PROD_BRDG (cr=33 pr=0 pw=0 time=10014 us cost=15 size=145880 card=18235)
          0             HASH JOIN  (cr=0 pr=0 pw=0 time=0 us cost=2686 size=99785032 card=402359)
          0              BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0               PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
          0                PX SEND BROADCAST :TQ10001 (cr=0 pr=0 pw=0 time=0 us cost=111 size=403328 card=8768)
       8768                 NESTED LOOPS  (cr=274 pr=0 pw=0 time=13429 us cost=111 size=403328 card=8768)
          1                  NESTED LOOPS  (cr=5 pr=0 pw=0 time=206 us cost=5 size=28 card=1)
          1                   TABLE ACCESS FULL DMN_WK_END (cr=2 pr=0 pw=0 time=82 us cost=3 size=8 card=1)
          1                   TABLE ACCESS BY INDEX ROWID DMN_CALN (cr=3 pr=0 pw=0 time=111 us cost=2 size=20 card=1)
          1                    INDEX RANGE SCAN XNU1_DMN_CALN (cr=2 pr=0 pw=0 time=80 us cost=1 size=0 card=1)(object id 303867)
       8768                  TABLE ACCESS FULL DMN_CALN (cr=269 pr=0 pw=0 time=9306 us cost=106 size=157824 card=8768)
          0              PX BLOCK ITERATOR PARTITION: KEY KEY (cr=0 pr=0 pw=0 time=0 us cost=2573 size=81276518 card=402359)
          0               TABLE ACCESS FULL FCT_NONRET_SLS_CURR_TRANS_WKLY PARTITION: 32 32 (cr=0 pr=0 pw=0 time=0 us cost=2573 size=81276518 card=402359)
          0        BUFFER SORT (cr=0 pr=0 pw=0 time=0 us)
          0         PX RECEIVE  (cr=0 pr=0 pw=0 time=0 us cost=134645 size=256764073 card=888457)
          0          PX SEND ROUND-ROBIN :TQ10002 (cr=0 pr=0 pw=0 time=0 us cost=134645 size=256764073 card=888457)
    1284599           HASH GROUP BY (cr=131502 pr=917687 pw=917687 time=1052831032 us cost=134645 size=256764073 card=888457)
    6439189            HASH JOIN RIGHT SEMI (cr=131490 pr=138092 pw=138092 time=374140098 us cost=100193 size=256764073 card=888457)
       4857             VIEW  VW_SQ_2 (cr=47 pr=0 pw=0 time=22869 us cost=26 size=16428 card=4107)
       4857              HASH JOIN  (cr=47 pr=0 pw=0 time=21073 us cost=26 size=229992 card=4107)
       1115               TABLE ACCESS FULL DMN_PROD (cr=11 pr=0 pw=0 time=687 us cost=6 size=13380 card=1115)
       4873               HASH JOIN  (cr=36 pr=0 pw=0 time=12522 us cost=20 size=180840 card=4110)
         55                TABLE ACCESS FULL DMN_MKT_DEFN (cr=3 pr=0 pw=0 time=242 us cost=4 size=1980 card=55)
      18235                TABLE ACCESS FULL FCT_MKT_PROD_BRDG (cr=33 pr=0 pw=0 time=9883 us cost=15 size=145880 card=18235)
    8986531             HASH JOIN  (cr=131443 pr=138092 pw=138092 time=402921160 us cost=100161 size=253210245 card=888457)
       8768              TABLE ACCESS FULL DMN_CALN (cr=269 pr=0 pw=0 time=11228 us cost=106 size=157824 card=8768)
    8986531              MERGE JOIN CARTESIAN (cr=131174 pr=138092 pw=138092 time=382931385 us cost=100049 size=237218019 card=888457)
          1               NESTED LOOPS  (cr=5 pr=0 pw=0 time=251 us)
          1                NESTED LOOPS  (cr=4 pr=0 pw=0 time=225 us cost=5 size=28 card=1)
          1                 TABLE ACCESS FULL DMN_WK_END (cr=2 pr=0 pw=0 time=127 us cost=3 size=8 card=1)
          1                 INDEX RANGE SCAN XNU1_DMN_CALN (cr=2 pr=0 pw=0 time=88 us cost=1 size=0 card=1)(object id 303867)
          1                TABLE ACCESS BY INDEX ROWID DMN_CALN (cr=1 pr=0 pw=0 time=17 us cost=2 size=20 card=1)
    8986531               BUFFER SORT (cr=131169 pr=138092 pw=138092 time=378126634 us cost=100047 size=212341223 card=888457)
    8986531                TABLE ACCESS BY GLOBAL INDEX ROWID FCT_PLN_RET_SLS_CURR_WKLY PARTITION: 30 30 (cr=131157 pr=0 pw=0 time=144384133 us cost=100044 size=212341223 card=888457)
    9066976                 INDEX RANGE SCAN SUBSTR_FCT_RET_SLS_CUR_WLY (cr=84385 pr=0 pw=0 time=93762049 us cost=83615 size=0 card=2856894)(object id 311617)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      os thread startup                               2        0.08          0.15
      PX Deq: Join ACK                                4        0.00          0.00
      PX Deq Credit: send blkd                      455        2.21         55.10
      PX Deq: Parse Reply                             4        0.01          0.01
      PX Deq: Execute Reply                      250046      247.89        439.12
      asynch descriptor resize                        9        0.00          0.00
      PX Deq Credit: need buffer                    549        1.54         15.84
      PX qref latch                                 235        0.01          0.18
      Disk file operations I/O                       42        0.00          0.00
      direct path write temp                      62665        0.25        365.50
      direct path read temp                       99442        0.46       1024.89
      db file sequential read                     36025        0.15        186.86
      latch: object queue header operation           17        0.00          0.00
      latch free                                      2        0.00          0.00
      log file switch (private strand flush incomplete)
                                                      1        0.07          0.07
      latch: messages                                 1        0.00          0.00
      log file switch completion                     14        0.08          0.79
      latch: cache buffers chains                     2        0.00          0.00
      latch: redo allocation                          1        0.00          0.00
      PX Deq: Signal ACK RSG                          4        0.06          0.07
      PX Deq: Signal ACK EXT                          4        0.00          0.01
      PX Deq: Slave Session Stats                     4        0.00          0.00
      enq: PS - contention                            1        0.00          0.00

Maybe you are looking for