How to find which query taking more cpu

Hi,
How to find which query taking more CPU
at a particular point of time .
Chhers,

Take a look at Server Standard Reports. It has a few CPU usage oriented reports.
You can also track CPU usage by server-side tracing:
http://www.sqlusa.com/bestpractices/createtrace/
Glenn Berry's CPU usage query:
SELECT TOP(25) p.name AS [SP Name], qs.total_worker_time AS [TotalWorkerTime],
qs.total_worker_time/qs.execution_count AS [AvgWorkerTime], qs.execution_count,
ISNULL(qs.execution_count/DATEDIFF(Second, qs.cached_time, GETDATE()), 0) AS [Calls/Second],
qs.total_elapsed_time, qs.total_elapsed_time/qs.execution_count
AS [avg_elapsed_time], qs.cached_time
FROM sys.procedures AS p WITH (NOLOCK)
INNER JOIN sys.dm_exec_procedure_stats AS qs WITH (NOLOCK)
ON p.[object_id] = qs.[object_id]
WHERE qs.database_id = DB_ID()
ORDER BY qs.total_worker_time DESC OPTION (RECOMPILE);
LINK:
http://dba.stackexchange.com/questions/52216/sql-server-2008-high-cpu-historical-queries
Query optimization:
http://www.sqlusa.com/articles/query-optimization/
Kalman Toth Database & OLAP Architect
SELECT Video Tutorials 4 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • How to find which query need to tuned

    Hi ,
    How can i find , which query need to tuned . Is there any mechanism behind it?

    The mechanisms behind it are depending on your database version.
    For example:
    Oracle 9i has STATSPACK that helps you to identify possible problem queries.
    Oracle 10g has AWR - Automatic Workload Repository
    Oracle 11g has SPA - Database Replay SQL Performance Analyzer
    but there are many more tools/mechanisms...trace/tkprof for example.
    Go to http://tahiti.oracle.com and do a search on 'performance tuning guide', and pick the one that matches your (sofar unknown) database version, read a bit every now and then and see what tools are at your disposal and fit your requirement and situation.
    Besides the links that Blu already posted, searches on http://asktom.oracle.com also give lots of pointers and explanations regarding the (neverending) tuning process (at least: helped me tremendously in understanding the tuning process, the do's and dont's).
    Make sure you don't get CTD (Compulsive Tuning Disorder) from all this... ;)

  • How to find which query ORA-1652: unable to extend temp segment by 128 in

    How can i find which query caused the below error,the query is not running currently
    ORACLE ERRORS IN ALERTS LOG dnb2stg3 - lnx300 on Thu Jun 17 12:10:01 EDT 2010
    1 ORA-1652: unable to extend temp segment by 128 in tablespace TEMP_SCHED
    SQL> select inst_id, tablespace_name, total_blocks, used_blocks, free_blocks from gv$sort_segment;
    INST_ID TABLESPACE_NAME TOTAL_BLOCKS USED_BLOCKS FREE_BLOCKS
    1 TEMP 638336 0 638336
    4 TEMP 565760 0 565760
    4 TEMP_SCHED 16776704 0 16776704
    3 TEMP 484864 0 484864
    3 TEMP_SCHED 0 0 0
    2 TEMP 455808 0 455808
    6 rows selected.
    SQL> SQL> SELECT S.sid || ',' || S.serial# sid_serial, S.username,
    2 T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace,
    3 T.sqladdr address, Q.hash_value, Q.sql_text
    FROM v$sort_usage T, gv$session S, gv$sqlarea Q, dba_tablespaces TBS
    4 5 WHERE T.session_addr = S.saddr
    6 AND T.sqladdr = Q.address (+)
    7 AND T.tablespace = TBS.tablespace_name
    8 ORDER BY S.sid;
    no rows selected

    Hello,
    You may try to catch the SQL with a Servererror Trigger.
    This link will give you an interesting example:
    http://oratips-ddf.blogspot.com/2008/09/to-err-is-human.html
    Hope this help.
    Best regards,
    Jean-Valentin

  • How to find which Query is using program AQ10MM==========Z6============

    Hi,
    I wanted to know how to find out which SAP query uses this program. AQ10MM==========Z6============
    I tried with SQ01/02 but was unable to get it. Can you please help.
    Regards,
    Mukund S

    In my installation , it is usually AQZZ"usergroup"========QUERYNAME======
    You could see if you have a user group 'MM' or '10MM' in SQ03 and set the user group if available.. then in SQ01, see if you have a query called Z6
    Also try out this function module RSAQ_DECODE_REPORT_NAME to see if it would give you the user group and query name...

  • How to find top 10  SQL statments which are consuming more cpu time.

    hi all,
    Is there any command or script to monitor the top 10 sql statments which are consuming more cpu time.
    I know by using AWR REPORT we can find it, i want the command or script to find the top cpu utilization sql statments.
    Regards
    Subhash.

    Subhash,
    A quick and dirty Google search could have get you started with the following:
    Thread: how to get top CPU consuming sql oracle 10g
    Re: how to get top CPU consuming sql oracle 10g
    Oracle SQL top sessions
    http://www.dba-oracle.com/oracle10g_tuning/t_sql_top_sessions.htm
    "How to Find top 10 expensive sql's", version 9.2.0
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:73325450402303
    HTH,
    Thierry

  • How to find bex query name of which dashboard built on?

    How to find bex query name of which dashboard built on?

    Hello,
    When you add a "SAP BW Connection" to you dashboard, you find in the output parameters the query technical name and the query description. you can bind it to the embedded spreedsheet and then use it in yoyr dashboard
    Best regards,
    Mohamed AISSA

  • Oracle internal queries taking more CPU time

    Hi,
    Following are queries taking more CPU time. I got this from awr report. Can anyone tell me why these queries are running? Is it a oracle enterprise manager query? should I use
    emctl stop dbconsole to stop this?
    DECLARE job BINARY_INTEGER := :job; next_date DATE := :mydate; broken BOOLEAN := FALSE; BEGIN EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS(); :mydate := next_date; IF broken THEN :b := 1; ELSE :b := 0; END IF; END;
    SELECT COUNT(*) FROM MGMT_METRIC_DEPENDENCY_DETAILS DEP, MGMT_SEVERITY SEV WHERE DEP.TARGET_GUID = :B5 AND DEP.METRIC_GUID = :B4 AND DEP.KEY_VALUE = :B3 AND DEP.EDEP_TARGET_GUID = SEV.TARGET_GUID AND DEP.EDEP_METRIC_GUID = SEV.METRIC_GUID AND DEP.DEP_KEY_VALUE = SEV.KEY_VALUE AND SEV.COLLECTION_TIMESTAMP BETWEEN :B2 AND :B1
    SELECT CURRENT_STATUS FROM MGMT_CURRENT_AVAILABILITY WHERE TARGET_GUID = :B1
    Thanks in advance
    With Regards
    boobathi.P

    Hi,
    maybe this document will help if you are using 10g:
    SQL run by SYSMAN consuming a lot of resources on OMS with 800+ targets [ID 330383.1]
    https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=PROBLEM&id=330383.1
    there you'll find Cause and Solution too:
    SYSMAN Job and Queries are Taking Up High CPU (DB Console) [ID 1288301.1]
    https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=PROBLEM&id=1288301.1
    For databases above version 11.1 there are paches available.
    Best,
    Michael T. Z.

  • In SQL Trace how to see which statement getting more time .

    Hi Expart,
    In SQL Trace (T-code ST05) . I am running the standard transaction . how to see which statement
    running more time and less time . suppose one statement running more time so how resolve the
    performance .
    Plz. reply me
    Regards
    Razz

    > The ones in 'RED' color are the statement which are taking a lot of time and you need to
    > optimise the same.
    No, that is incorrect, the red ones show only the ones which need several hundret milliseconds in one execution. This can even be correct for hard tasks. And there are lots of problem, which you will not see
    I have said everything here:
    SQL trace:
    /people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy
    Go to 'Tracelist' -> Summarize by SQL statements', this is the view which you want to see!
    I summarizes all executions of the same statement.
    There are even the checks explained, the slow ones are the one which need a lot of time per record!
    See MinTime/Rec > 10.000 microseconds.
    Check all number of records, executions, buffer, identicals.
    The SE30 Tipps and Tricks will not help much.
    Siegfried

  • How to Find Which Programs running in my Domain Computers

    How to Find Which Programs running in my Domain Computers.

    In addition, there are other third tools you can use. Here is a script from the TechNet Scripting Gallery:
    List All Installed Software
    Returns a list of all software installed on a computer, whether or not by Windows Installer. This script reads installed applications from the registry. (See Richard Mueller's comment on how to output it to a CSV file)
    http://gallery.technet.microsoft.com/scriptcenter/8035d5a9-dc92-436d-a60c-67d381da15a3/view/Discussions
    Of course that's just running it against one computer. There's also a script in the above link (scroll to the bottom) that will find installed software of a list of computers in a network and also detect the defined forbidden installed software, and
    another script that will uninstall that software remotely.
    Overall however, if you want to do this network wide with much a much easier method (although more complex to setup), I agree with using SCCM or Spiceworks. There is also Altiris, and a number of other third party solutions that you can use.
    Maybe if you can provide more specific information on the end result of the solution you are looking for, we can provide more specifics to help you.
    Ace Fekay
    MVP, MCT, MCSE 2012, MCITP EA & MCTS Windows 2008/R2, Exchange 2013, 2010 EA & 2007, MCSE & MCSA 2003/2000, MCSA Messaging 2003
    Microsoft Certified Trainer
    Microsoft MVP - Directory Services
    Complete List of Technical Blogs: http://www.delawarecountycomputerconsulting.com/technicalblogs.php
    This posting is provided AS-IS with no warranties or guarantees and confers no rights.

  • How to Find the Query used by the Workbook ?

    Hi ,
    I am currently involved in trouble shooting a work book where some master data values are not being displayed.
    How do i find, which Query the work books is using ? or Let me know as to how should i proceed in solving the same .

    Hi,
    If you have access to BW Admin workbench... then choose the option metadatarepository(left side) of the BW admin workbench, search for the workbook(Technical name) and click on the "Network display dataflow" link.
    If you want to know the relationship between workbook and the queries:
    Check table RSRWORKBOOK which contains the WORKBOOKID and the GENUNIID.
    Table RSRREPDIR contains GENUNIID, query name RNAME, AUTHOR, LASTUSER, INFOCUBE
    Table RSRINDEXT contains the WORKBOOKID and workbook TITLE
    You should join the tables by GENUNIID and select in RSRREPDIR the rows that have COMPTYPE='REP' for queries and object version active/modified.
    With this information an infoset query can be created to list all workbook-query-user relationship (and even the query-infocube relationship).
    Hope this helps u...
    Regards,
    KK.

  • How to find which instance in the RAC cluster the application is connected

    How to find which instance in the RAC cluster the application is connected to ?
    Raees

    well if you know the user through which your application is connected to instance, you can easily find out by querying gv$session view.
    select inst_id,sid,serial#,program,username from gv$session where username is not null;
    Thanks
    Gaurav

  • How to find which datasource is using table JCDS?

    How to find which datasource is using table JCDS?

    Hi,
    Please find the below link and identify whether will it meet your requirement or not ... If it meets your requirement then I can provide you more documents related to the same which we have in our project.   We were using the same for Plant Maintanance project...
    For this report the required information is gathering from the different data sources from the ECC system. This report requires object status functional location attributes, Equipment attributes and some specific information apart from normal transaction data for an order.
    u2022     Main feeding data sources for this report are 2LIS_17_ORDER and 2LIS_18_ORDER.
    u2022     Requires the object status data (system status, number object status and un-number system status) is feeding from different DSO where the status data is staging with different data flow.
    u2022     Requires the Order planned end date which is dependent on the operation  planned completion date. so we are feeding this field from Operationu2019s DSO where the planned date is staging with different data flow.
    u2022     Required characteristic data and attributes of the Functional location  is getting from the master data .The 0FUNCT_LOC is updating by master data data sources
    u2022     Required standard class  of the functional location is updating from other DSO where the  classification  data is staging with the help of different data flow.
    2LIS_17_ORDER and 2LIS_18_ORDER Data flow Details : No enhancement was done for these data sources .
    Status Data Flow Details:
    The status data is staged because ,this dat is required for the reports based on the Orders, Operations , Notifications, Functional Location and Equipment.
    To load suitable data to different DSOs from the Status DSO we maintain the Filters for status profile and status at DTP level.
    Required status change dates  are deriving based on changed on date ,system status while loading from status DSO to Order DSO.
    The system status ,Number object status and un- numberd object status are feeding from status DSO only.The status DSO is updating by u20180TE_OBJ_STATUS_HISTu2019.This Is based on the tables JCDS,JSTO and T000.
    JCDS     MANDT     =     JSTO     MANDT
    JCDS     OBJNR          =     JSTO     OBJNR
    T000     MANDT     =     JCDS     MANDT
    This DS has enhanced for the below  two fields
    1.     Order Number
    2.     Operation/Activity Number
    The Logic to populate the above two fileds is as below.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/e4/1522bae6aa46b8802dca454e846d58/frameset.htm
    regards
    BVR

  • How to find Which one is my Message Server in AIX with DB2

    Hi SAP Guru's
    PS1 is my Production system(R/3)
    in this we have 5 Applications Servers
    how to find which one is my Message Server/ Central Instance.
    Note : Enqueus Reside in MainFrame Server
    OS: AIX
    DB: DB2
    R/3: 4.7   620 Kernal Version.
    you need more information Plz. let me know
    I appriciate who gives more explanation
    Thanks & Regards,
    Kishore Reddy

    Hi Ruchit,
    cpaiss51     cpaiss51_PS1_06      PS1_D06_CPAISS51
                                 DrainBatch           15   -   -   3   5   1   -  24
                                 Normal Operations    10   5   -   3   5   1   -  24
                                 Specialbatch         10   5   -   3   5   1   -  24
                                 THDNIGHTLYBATCH      10   5   -   3   5   1   -  24
    cpaiss54     cpaiss54_PS1_06      PS1_D06_CPAISS54
                                 DrainBatch           46   -   -   3   5   1   -  55
                                 Normal Operations    34  12   1   3   5   1   -  55
                                 Specialbatch         34  12   1   3   5   1   -  55
                                 THDNIGHTLYBATCH      34  12   1   3   5   1   -  55
    cpaiss56     cpaiss56_PS1_06      PS1_D06_CPAISS56
                                 DrainBatch           46   -   -   3   5   1   -  55
                                 Normal Operations    34  12   1   3   5   1   -  55
                                 Specialbatch         34  12   1   3   5   1   -  55
                                 THDNIGHTLYBATCH      34  12   1   3   5   1   -  55
    cpaiss89     cpaiss89_PS1_06      PS1_D06_CPAISS89
                                 DrainBatch           46   -   -   3   5   1   -  55
                                 Normal Operations    34  12   -   3   5   1   -  55
                                 Specialbatch         34  12   -   3   5   1   -  55
                                 THDNIGHTLYBATCH      34  12   1   3   5   1   -  55
    cpaiss90     cpaiss90_PS1_06      PS1_D06_CPAISS90
                                 DrainBatch           46   -   -   3   5   1   -  55
                                 Normal Operations    34  12   1   3   5   1   -  55
                                 Specialbatch         34  12   1   3   5   1   -  55
                                 THDNIGHTLYBATCH      34  12   1   3   5   1   -  55
    Thanks & Regards,
    Kishore REddy

  • How to find database query

    Hi all,
    how to find physical query from report here m checking like Administrator->manage session--> report-->view log
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- SQL Request:
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- General Query Info:
    Repository: Star, Subject Area: AAA, Presentation: AAA
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Cache Hit on query:
    Matching Query:     Created by:     Administrator
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Query Status: Successful Completion
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Physical Query Summary Stats: Number of physical queries 1, Cumulative time 0, DB-connect time 0 (seconds)
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Rows returned to Client 6
    +++Administrator:3220000:3220011:----2011/01/03 02:51:43
    -------------------- Logical Query Summary Stats: Elapsed time 0, Response time 0, Compilation time 0 (seconds)
    but here m not able to find database query..how to find that query plz help
    Edited by: Sonal on Jan 3, 2011 5:29 AM
    Edited by: Sonal on Jan 3, 2011 5:30 AM
    Edited by: Sonal on Jan 3, 2011 5:30 AM

    Hi,
    as Daan said, set the variable in Advanced tab but not on loglevel..
    because, our problem is to bypass the bi-server cache.
    Do this:
    1. Go to Advanced tab.
    2. In Prefix field(scroll down to see this field) , enter this:
    SET DISABLE_CACHE_HIT = 1;
    Note: Make sure that you're ended up above statement with semicolon and do not click on Set SQL option...
    3. Save report, then run it..
    4. After you see the query, i recommend you to take take out that prefix tag then save it again..

  • How to find a query name from report name

    I have a report in my system with the name AQICMM==========P2============ . I believe this was created from a query. How to find the query corresponding to this report ? I need to change the logic for certain columns of the report. How to know if this was created from SQVI or SQ01 or any other transaction.
    THanks.

    Found it..Query name is P2. It was in a different query area..Standard area and not custom area where I was initially looking at.
    Edited by: Shareen Hegde on Aug 22, 2008 5:14 PM

Maybe you are looking for

  • Error message when plug in ipad "iTunes could not connect to this iPhone. The device is no longer connected."

    I set up my iPad a couple months ago, but it wasn't really customized. I plugged it into my computer for the first time in a couple months and got this error that kept popping up so constantly that I could not do anything in iTunes when it was up, bu

  • Here's how I restored my mini from the dead (Win XP)

    When I installed the 1.4 updater on my iPod, it erased everything on it. Here's what I did to fix it: 1) Uninstall the 1.4 software 2) Disconnect the iPod from the computer, but do so safely, even if you have to reboot the computer. 3) Reset your iPo

  • Can't install Safari 8.0.4 on Yosemite 10.10.2

    Hi! I've been having problems with Safari 8.0.4. First Yosemite installed Safari along some security updates, but after restart I got a error message saying some installation failed and it was Safari. So I downloaded the standalone installer from the

  • Reading post script files

    Does Adobe offer a program that reads post script files?

  • My GUI freezes

    Hey, I'm writing a small client/server application and I'm getting a problem, when I start the server the GUI freezes and I haven't been able to solve the problem. Any help will be much appreciated. I use 2 classes, Server which handles the serversoc