Sql statemet takes huge amout of resource !

Friends ,
I am using Oracle 10g (10.2.0.1) database in AIX 5.3 server . Last few days I observe that some sql ( 2 statements ) query takes a high resource . And sometimes when a user generate that particular sql statement , then it takes a huge time to execute .
I think , sql stqtement needs to be tuned . But the question is , these statement runs from the last 1 year and i dont get any resource related error during this period . I dont understand the reason why this statement now takes huge resource .
In this moment , would anybody plz advice me , which area I need to check to find out the exact problem ?
In below I paste the one of sql statement :
SELECT gldtdate,SA.glid,SA.glparentid,SA.gldescription,SA.glcode,SA.glmapcode, SA.gllevel,SUBSTR(glcode,:"SYS_B_00",:"SYS_B_01") AS gltype, NVL(SUM(CASE WHEN GLDTTYPE = :"SYS_B_02" THEN GLDTDEBIT ELSE :"SYS_B_03" END),:"SYS_B_04") CAD, NVL(SUM(CASE WHEN GLDTTYPE = :"SYS_B_05" THEN GLDTDEBIT ELSE :"SYS_B_06" END),:"SYS_B_07") CLD, NVL(SUM(CASE WHEN GLDTTYPE = :"SYS_B_08" THEN GLDTDEBIT ELSE :"SYS_B_09" END),:"SYS_B_10") TRD, NVL(SUM(CASE WHEN GLDTTYPE IN (:"SYS_B_11",:"SYS_B_12", :"SYS_B_13") THEN :"SYS_B_14" ELSE :"SYS_B_15" END),:"SYS_B_16") VD, NVL(SUM(CASE WHEN GLDTTYPE = :"SYS_B_17" THEN GLDTCREDIT ELSE :"SYS_B_18" END),:"SYS_B_19") CAC, NVL(SUM(CASE WHEN GLDTTYPE = :"SYS_B_20" THEN GLDTCREDIT ELSE :"SYS_B_21" END),:"SYS_B_22") CLC, NVL(SUM(CASE WHEN GLDTTYPE = :"SYS_B_23" THEN GLDTCREDIT ELSE :"SYS_B_24" END),:"SYS_B_25") TRC, NVL(SUM(CASE WHEN GLDTTYPE IN (:"SYS_B_26",:"SYS_B_27", :"SYS_B_28") THEN :"SYS_B_29" ELSE :"SYS_B_30" END),:"SYS_B_31") VC, NVL(SUM(CASE WHEN GLDTTYPE = :"SYS_B_32" THEN :"SYS_B_33" ELSE :"SYS_B_34" END),:"SYS_B_35") CACV, NVL(SUM(CASE WHEN GLDTTYPE = :"SYS_B_36" THEN :"SYS_B_37" ELSE :"SYS_B_38" END),:"SYS_B_39") CADV FROM GLACCOUNT sa, VW_USER_ALL_TXN WHERE sa.glid = gldtglid AND GLDTDATE =TO_DATE(:"SYS_B_40",:"SYS_B_41") AND UPPER(MC_User)=:"SYS_B_42" AND GLDTBRANCHID =:"SYS_B_43" GROUP BY gldtdate,SA.glid,SA.glparentid,SA.gldescription,SA.glcode,SA.glmapcode,SA.gllevel ORDER BY SUBSTR(SA.GLCODE,:"SYS_B_44",:"SYS_B_45")DESC,SA.glmapcode

thx anantha ,
Here I paste the execution plan of the above query :
Execution Plan----------------------------------------------------------
Plan hash value: 3013799171
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 8168 | 16336 | 25 (4)| 00:00:01 |
| 1 | COLLECTION ITERATOR PICKLER FETCH| DISPLAY | | | | |
Statistics
104 recursive calls
24 db block gets
87 consistent gets
2 physical reads
0 redo size
16784 bytes sent via SQL*Net to client
309 bytes received via SQL*Net from client
12 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
161 rows processed

Similar Messages

  • Photos on ipad2, take huge amount of space. What'd it be the answer ?

    Photos on ipad2, take huge amount of space. What'd it be the answer ? The iCloud doesn't seem to have enough free space.

    Photos on ipad2, take huge amount of space. What'd it be the answer ? The iCloud doesn't seem to have enough free space.

  • MacBook Pro with SSD that has a limited disk space (120GB). Rendering in Project File (User/Movies/Final Cut Projects), it takes huge space and the limited disk space would not be enough for the whole editing.

    I'm using MacBook Pro with 128GB SSD that has a limited disk space. As we know, when rendering in Project File (User/Movies/Final Cut Projects), it takes huge space and the limited disk space would not be enough for the whole editing.
    My question is, Is there any method to get the rendering Projects file saved into an external hard drive which is connected with USB/ Thunderbolt/ Firewire, with huge disk space (eg. 500GB HDD).
    Now, new project created in my Mac is automatically saved in (User/Movies/Final Cut Projects) and my Mac has ran out of space to hold the files.
    Thank you.

    You have at least 3 different ways to show the project library:
    1) Go to WIndow->Show Project Library
    2) Click the button in bottom left of your window: 
    3) Hit the keyboard shortcut (Command-0)
    The project library will be shown, occupying the area where the timeline usually is.
    Your hard disks will be visible. Click the hard disk where you want the new project to reside and hit Cmd-N to create a new project.

  • Estimating how much time a sql will take

    Is there a way to estimate how long a sql will take. Is there a command in sql to estimate the time?
    Is there a direct correction when looking at the COST in the explain plan to the amount of time a sql will take? Thank you in advance.

    No. You might as well ignore the cost number. Anything to do with the cost-based optimizer, Jonathan Lewis is your man. His interpretation of cost is "the time to completion of a query, but expressed in units of single block reads rather than in proper time units".
    Of course, as Tom Kyte points out, the Explain Plan is only a mathematical model predicting the query's performance. Cost is an estimate not a guarantee.
    Cheers, APC

  • Zimbra login is very slow - SQL query takes 35+ seconds

    Hi,
    my Zimbra login process remains very slow, 35-40 seconds with only a single user using it. I have Beehive set up as directory synchronized, with about 6500 users in it. However, I and a couple of colleagues the only ones making any use of it for testing. With just one person logging in, the following SQL query takes about 35 seconds to execute:
    SELECT /*+ LEADING(rf rf_pp) USE_NL(rf_pp) INDEX_ASC(@rf_connect_by rf@rf_connect_by (ws_real_folders.parent_eid ws_real_folders.eid)) */ RF.ENTERPRISE_ID AS
    ENTERPRISE_ID, RF.SITE_ID AS SITE_ID, RF.ENTITY_TYPE AS ENTITY_TYPE, RF.EID AS EID, RF.LOCK_ID AS LOCK_ID, RF.CACHE_ID AS CACHE_ID, RF.CACHE_TS AS
    CACHE_TS, RF.CACHE_SQ AS CACHE_SQ, FLOOR(RF.SECURE_CHECK/10) AS ACCESS_TYPES, RF.PARENT_ENTITY_TYPE AS PARENT_ENTITY_TYPE, RF.PARENT_EID AS
    PARENT_EID, RF.NAME AS NAME, RF.OWNER_ENTITY_TYPE AS OWNER_ENTITY_TYPE, RF.OWNER_EID AS OWNER_EID, RF.CREATED_ON AS CREATED_ON,
    RF.CREATOR_ENTITY_TYPE AS CREATOR_ENTITY_TYPE, RF.CREATOR_EID AS CREATOR_EID, RF.MODIFIEDON AS MODIFIED_ON, RF.MODIFIED_BY_ENTITY_TYPE AS
    MODIFIED_BY_ENTITY_TYPE, RF.MODIFIED_BY_EID AS MODIFIED_BY_EID, RF.VISIBILITY AS VISIBILITY, CASE WHEN (BITAND(:B13 , :B12 ) = :B12 ) THEN CAST(MULTISET(
    SELECT METADATA_CEN
    FROM OCS_ENTITY_METADATA_CENS_2_V META
    WHERE META.ENTITY_EID = RF.EID ) AS OCS_COLLAB_ID_TBL_T) ELSE CAST(NULL AS OCS_COLLAB_ID_TBL_T) END AS METADATA_CENS, CASE WHEN
    RF_PP.LAST_ACCESSED IS NULL THEN 'N' WHEN RF.MODIFIEDON > RF_PP.LAST_ACCESSED THEN 'U' ELSE NVL(RF_PP.RELATIVE_STATUS, 'N') END AS CHANGE_STATUS,
    RF.PROPERTIES AS PROPERTIES_CLOB, RF_PP.PROPERTIES AS VIEWERPROPERTIES_CLOB, RF.DESCRIPTION AS DESCRIPTION
    FROM (
    SELECT /*+ QB_NAME(rf_connect_by) no_connect_by_cost_based */ RF.ENTERPRISE_ID ENTERPRISE_ID, :B4 SITE_ID, :B3 ENTITY_TYPE, RF.EID EID, RF.LOCK_ID LOCK_ID,
    RF.ORA_ROWSCN CACHE_ID, RF.CACHE_TS CACHE_TS, RF.CACHE_SQ CACHE_SQ, RF.PARENT_TYPE PARENT_ENTITY_TYPE, RF.PARENT_EID PARENT_EID, RF.NAME
    NAME, RF.OWNER_TYPE OWNER_ENTITY_TYPE, RF.OWNER_EID OWNER_EID, RF.CREATED_ON CREATED_ON, RF.CREATOR_TYPE CREATOR_ENTITY_TYPE,
    RF.CREATOR_EID CREATOR_EID, RF.MODIFIED_ON MODIFIEDON, RF.MODIFIED_BY_TYPE MODIFIED_BY_ENTITY_TYPE, RF.MODIFIED_BY_EID MODIFIED_BY_EID,
    RF.VISIBILITY VISIBILITY, RF.PROPERTIES PROPERTIES, RF.DESCRIPTION DESCRIPTION, RF.IS_HIDDEN IS_HIDDEN, LEVEL LEVEL_NUM, COALESCE (
    (SELECT :B10 * 10 + 1
    FROM AC_ENTITIES AEI
    WHERE RF.EID = AEI.EID AND ( 1 = DECODE(AEI.SENSITIVITY_EID, :B9 , 1, 0) AND 1 = DECODE(AEI.OWNER_EID, :B8 , 1, 0) AND 1 = DECODE(AEI.AT_READ, :B7 , 1, 0) AND 1 =
    DECODE(AEI.AT_DISCOVER, :B6 , 1, 0) AND 1 = DECODE(AEI.LOCAL_ACL_ID, :B5 , 1, 0) ) ) ,
    (SELECT ACV.ACCESS_TYPES * 10 + ACV.IS_ALLOWED
    FROM AC_CHECK_ONE_OF_V ACV
    WHERE ACV.EID = RF.EID ) ) SECURE_CHECK
    FROM WS_REAL_FOLDERS RF
    WHERE RF.IS_HIDDEN = :B2 START WITH RF.PARENT_EID = :B1 CONNECT BY PRIOR RF.EID = RF.PARENT_EID ) RF, WS_RF_PRVT_PROPERTIES RF_PP
    WHERE RF.EID = RF_PP.EID (+) AND :B11 = RF_PP.VIEWER_EID (+) AND 1 = BITAND(RF.SECURE_CHECK, 1) ORDER BY RF.LEVEL_NUMIt has ID atrvjdrmz2v6d in Enterprise Manager, and I've tried tuning it with the SQL tuning advisor in EM. I did the statistics gathering mentioned in another thread yesterday, to see if that helped - doesn't seem liked it. I'm running Database 11.1.0.6 and Beehive 1.5.1 in the build from the day it released.
    Any hints? I'll post this to MetaLink as well, unless someone has some immediate idea what's wrong :-)

    No speedup, the 35-40 seconds is for normal logins - and it's very consistent, at least if the database is otherwise idle. Immediately logging out and back in gives me the same wait, and the same query shows up in the Enterprise Manager interface.
    It seems it might be related to Workspaces - from EM:
    "PL/SQL Source (Line Number)          BEE_CODE.WS_REAL_FOLDER_PKG (2998)"

  • ICloud photos process takes too much network resources

    Photos of iCloud process takes too much network resources in the background and slows down a lot the iMAC. Almost impossible to navigate or use applications that uses internet connections.
    I would like to pause the process or to configure it somehow to prevent excesive network utilization.

    Do you have iPhoto setup to import all Photo Stream photos into your library?  If so uncheck the circled checkbox in this screenshot and see if that will speed up things:
    You'll have to manually import from the Photo Stream after that.
    OT

  • ODS takes huge time

    Hi guys,
      The data lookup in the ODS is taking huge time .....it was working fine a week back it has around  200 mill records..
    Thanks,
    Your help will be greatly appreciated

    For two records, yes it shud not take that much time...
    Any just check the system performance on the same.. Some times the basis might be working on some backup activities which might also cause the issue in the system performace...
    So check if this is happening to everyone in ur project.. and also check the content directly from the ODS content instead of the listcube.. for the comparision..
    Also check how is ur system is loaded with?
    Thanks..
    Hope this helps

  • Does anyone know why parsing with PL/SQL parser takes too long

    I am parsing a XML document ( 168 K )
    which it contains 300 Nodes and each node has 22 attributes, it
    takes 5 minuts using xmldom calls ( from PL/SQL XML parser )..
    When I cut that file in to 2 files ( 85 K or so ) it takes 1
    minute per file..
    Any ideas why ??????
    Thanks

    I am parsing a XML document ( 168 K )
    which it contains 300 Nodes and each node has 22 attributes, it
    takes 5 minuts using xmldom calls ( from PL/SQL XML parser )..
    When I cut that file in to 2 files ( 85 K or so ) it takes 1
    minute per file..
    Any ideas why ??????
    Thanks

  • Sql Query takes too long to enter into the first line

    Hi Friends,
      I am using SQLServer 2008. I am running the query for fetching the data from database. when i am running first time after executed the "DBCC FREEPROCCACHE" query for clear cache memory, it takes too long (7 to 9 second) to enter into first
    line of the stored procedure. After its enter into the first statement of the SP, its fetching the data within a second. I think there is no problem with Sqlquery.  Kindly let me know if you know the reason behind this.
    Sample Example:
    Create Sp Sp_Name
    as
     Begin
     print Getdate()
      Sql statements for fetching datas
     Print Getdate()
     End
    In the above example, there is no difference between first date and second date.
    Please help me to trouble shooting this problem.
    Thanks & Regards,
    Rajkumar.R

     i am running first time after executed the "DBCC FREEPROCCACHE" query for clear cache memory, it takes too long (7 to 9 second)
    Additional to Manoj: A
    DBCC FREEPROCCACHE clears the procedure cache, so all store procedure must be newly compilied on the first call.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • SQL Server 2005 huge data migration. Taking more than 18 hours ...

    Hi,
    We are migrating an SQL server 2005 DB to Oracle 10 g 64 bit 10.2.0.5. The source sql server DB has few tables (<10) and only few stored procedure(<5). However one table of source is very huge, it has 70 million records in it. I started the migration process; it was running till 18 hours passed away then I cancelled it. I am using SQL Developer 3.1.0.7 with online migration.
    Kindly let me know if I choose offline migration will it reduce the data move time. Is there some other tool by oracle that can migrate huge data (records in millions) quickly. Is there some configuration in SQL Developer that can catalyses the process?
    Kindly help.
    Best Regards!
    Irfan

    I tried using SQL Loader to move data. The file exported by SQL server for the transaction table is of size around 17 GB. The sql loader stopped giving error on file size limit. The error is given below:
    SQL*Loader: Release 10.2.0.5.0 - Production on Thu Mar 22 15:15:28 2012
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    SQL*Loader-510: Physical record in data file (E:/mssqldata/transaction.txt) is longer than the maximum(1048576)
    SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
    C:\Users\Administrator\Desktop\wuimig\datamove\wuimig\2012-03-22_14-20-29\WUI\dbo\control>
    Please help me out how do I move such huge data to oracle from sql server.
    Best Regards!

  • Retreive External data from SQL making connection to SQL server take a long time

    I have an Excel pivottable based on a view from SQL server. The view gets data from 2 databases on the sames server. I have the sames login for both databases and also the same rights (datareader, datawriter and owner). When running the view from within
    the SQL Server management tool it goes quick. In Excel once the connection is made everything goes fast. Only making the connection takes a very long time. When I use a view with data from a single database then everything is fine and goes fast.
    Example of the situation: I use the example view below in an excel pivot. This gives as result that the connection takes very long.
    SQLServer A
    View CustomerInfo which contains the following query.
    Select * FROM databaseA.dbo.Customers as Customers
    CROSS APPLY
    SELECT *
    FROM databaseB.dbo.Contacts as Contacts
    Where Customers.Number = Contacts.CustomerNumber
    ) AS Contactdata
    When I remove the CROSS APPLY part, the connection is made directly
    We login to SQL with normal logon  (not windows security) The user has the same rights on both databases.
    I hope the problem is clear. Does anyone have an idea of how I can solve this problem?

    -1* ( prior dataid ) = parentid
    is it multiplying -1 times the prior dataid ?that's exactly what it's doing
    you need:
    prior dataid = ABS(parentid);
    not knowing you're data, and therefore assuming that dataid is always positive (since it doesn't have an ABS), and that parentid can be positive or negative, your criteria becomes
    parentid = prior dataid (handles both are positive)
    or parentid = negative of prior dataid (handles parentid is neg, dataid is pos)
    since the "prior" must be right next to the column (dataid), I put parens around the whole thing, and then mult by -1

  • SQL Developer takes 7 minutes to bring back list of packages

    The database is 11g R2 on 64bit Linux.
    Instance has multiple schemas
    SQLDev is v3.1.07 (download with JDK)
    SQL Dev connects without a problem.
    Click the "+" next to Functions, in a few seconds I get the list of functions.
    Click the "+" next to Procedures, in a few seconds I get the list of procedures.
    Click the "+" next to Packages, between 5 and 10 MINUTES later the list will display.
    The exact objects I choose to explore, or the order does not seem to matter.
    After 2 or 3 objects, the next load takes an unacceptable length of time.
    What is going on here?

    You can try to find out if the underlying query, that the sql developer issues against the data dictionary is slow.
    To do so first find the query, then issue the same query inside sql developer and check out the execution time and explain plan from there.
    To find the query you can connect with a DBA account. Use "Tools/Sessions .. " to monitor the sessions. Find the appropriate connection (check for the correct db user, and the module should be SQL Developer). Then start the slow action in the different session. Switch back to the session monitor and refresh it. Check out the SQL that is shown on "Active SQL" Tab.
    If this query is slow, then it is not a problem opf the sql developer but of your database installation. Maybe the dictionary cache is to small or the database did not apply statistics to the system tables. In such a case report the problem to your DBA.
    it could also be a problem of the connection. Do you use an oracle client to open the connection or something like a thin jdbc driver? try with the oracle client if you don't have that already.

  • Sql statement takes long to execute even with index

    Hi
    I have the following sql statement.
    Its explain plan states its "TABLE ACCESS FULL".
    But upon creation of index for table PWRKF2MV, using
    IDX(pafidt,ppdept,prodno,ppname) and IDX2(pmfaci,prodno), it uses both indexes
    but time taken to execute is still the same as when there is no indexes.
    Why is that so? Appreciate any help. Thank you.
    Pls take note that the PWRKF2MV is a materialized view and MITBALC0 is a synonym.
    SQL statement: -
    select a.ppdept dept, rtrim(b.mbsttx) prod, to_char(to_date(a.pafidt,'YYYYMMDD'),'Y')||to_char(to_date(a.pafidt,'YYYYMMDD'),'WW') as yrweek, sum(pmoqty) moqty
    from pwrkf2mv a, mitbalc0 b
    where a.pafidt between :p_startdate and :p_enddate
    and a.ppdept = nvl(:p_dept,a.ppdept)
    and a.prodno = nvl(:p_prodno,a.prodno)
    and a.ppname like '%'||:p_proddesc||'%'
    and rtrim(a.prefno) is not null
    and rtrim(b.mbsttx) is not null
    and a.pmfaci = b.mbwhlo
    and a.prodno = b.mbitno
    group by a.ppdept, b.mbsttx, to_char(to_date(a.pafidt,'YYYYMMDD'),'Y')||to_char(to_date(a.pafidt,'YYYYMMDD'),'WW')
    order by a.ppdept, yrweek, b.mbsttx;
    Siti

    Hi Siti,
    Is your table goes through frequent update and delete statements? if YES=>
    Free blocks created during this operation may dgrade the performance during full
    Tbale scan.
    If you are using Oracle 10g, you can shrink the segments. But first enable the row movement
    sql> alter table emp enable row movement;
    http://www.oracle.com/technology/oramag/oracle/05-may/o35tuning.html
    JAI HIND
    Darshan

  • Remove Duplicates in string sql AND TAKE THE CORRECT ONE

    Good Evening how can i perform this task with ssis  OR TRANSACT SQL? 
    I HAVE THESE ROWS WITH THE NEXT DATA, I want to take just the valid one, BUT I HAVE A LOT OF COMBINATIONS AS following names, it can be animals, things or personal names
    GABRIEL OBANDO --CORRECT
    GABRIEL OVANDO
    Gavriel OVANDO
    gAbriel OBANDO
    GABRIE OBANDO
    Gabri OBONDA
    MANAGUA --CORRECT
    NANAGUA
    NAMAGUA
    Thanks for the reply.

    Well it is not practically possible to identify the correct Name until you have a reference table or you have or knowledge base in
    Data Quality services.
    The only code which I can provide you is
    SELECT DISTINCT NAME
    FROM dbo.Test
    WHERE NAME = UPPER(NAME) COLLATE SQL_Latin1_General_CP1_CS_AS
    This code will check for the upper case name and select them. But it doesn't guarantee finding correct name when spelling is wrong. 
    If you have any table from where we can validate data then you can use below code
    SELECT DISTINCT Name
    FROM dbo.NameTable
    WHERE Name IN (SELECT Name FROM dbo.OtherNameTable)

  • SQL Developer occasionally hogs all CPU resources

    Client OS: Windows XP Professional
    Connecting to : Oracle 9.2.0.3 on Sun Solaris server
    I encountered a few instances where SQL Developer hogs all CPU resources on my Windows XP notebook.
    I usually have to kill the SQL Developer process.
    I have noticed this happening occasionally when I :
    1. hit Enter at the SQL Worksheet window
    2. hit F9 at the SQL Worksheet window - the query does not start
    How do I collect a dump or some kind of debug information when the above happens ?
    Who can I send the information to ?

    How do I collect a dump or some kind of debug
    information when the above happens ?Start SQLDeveloper using sqldeveloper.exe in <sqldeveloper>\jdev\bin
    When sqldeveloper starts hogging cpu, go to the console window and type ctrl-break. You should get a thread dump.
    Who can I send the information to ?If you have a support contract, you can raise a TAR, otherwise post the thread dump here.

Maybe you are looking for