Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 67711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:18:10+00:00 2026-05-10T19:18:10+00:00

The activity monitor in sql2k8 allows us to see the most expensive queries. Ok,

  • 0

The activity monitor in sql2k8 allows us to see the most expensive queries. Ok, that’s cool, but is there a way I can log this info or get this info via query analyser? I don’t really want to have the Sql Management console open and me looking at the activity monitor dashboard.

I want to figure out which queries are poorly written/schema is poorly designed, etc.

Thanks heaps for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T19:18:10+00:00Added an answer on May 10, 2026 at 7:18 pm
    1. Use SQL Server Profiler (on the tools menu in SSMS) to create a trace that logs these events:

       RPC:Completed  SP:Completed  SP:StmtCompleted  SQL:BatchCompleted  SQL:StmtCompleted 
    2. You can start with the standard trace template and prune it. You didn’t specify whether this was for a specific database or the whole server, if it is for specific Db’s, include the DatabaseID column and set a filter to your DB (SELECT DB_ID('dbname')). Make sure the logical Reads data column is included for each event. Set the trace to log to a file. If you are leaving this trace to run unattended in the background, it is a good idea to set a maximum trace file size say 500MB or 1GB if you have plenty of room (it all depends on how much activity there is on the server, so you will have to suck it and see).

    3. Briefly start the trace and then pause it. Goto File->Export->Script Trace Definition and pick your DB version, and save to a file. You now have a sql script that creates a trace that has much less overhead than running through the profiler GUI. When you run this script it will output the Trace ID (usually @ID=2); note this down.

    4. Once you have a trace file (.trc) (either the trace completed due to reaching the max file size or you stopped the running trace using

      EXEC sp_trace_setstatus @ID, 0
      EXEC sp_trace_setstatus @ID, 2

    You can load the trace into profiler, or use ClearTrace (very handy) or load it into a table like so:

    SELECT * INTO TraceTable FROM ::fn_trace_gettable('C:\location of your trace output.trc', default) 

    Then you can run a query to aggregate the data such as this one:

    SELECT COUNT(*) AS TotalExecutions,      EventClass, CAST(TextData as nvarchar(2000))  ,SUM(Duration) AS DurationTotal  ,SUM(CPU) AS CPUTotal  ,SUM(Reads) AS ReadsTotal  ,SUM(Writes) AS WritesTotal FROM TraceTable GROUP BY EventClass, CAST(TextData as nvarchar(2000)) ORDER BY ReadsTotal DESC 

    Once you have identified the costly queries, you can generate and examine the actual execution plans.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 59k
  • Answers 59k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer set myBigFatGlobalVariable 'hello' proc myFirstProc { var1 var2 } {… May 11, 2026 at 9:01 am
  • added an answer AS I've mentioned before, Raymond Chen has good advice on… May 11, 2026 at 9:01 am
  • added an answer Python's own internal compiler can parse this, if you use… May 11, 2026 at 9:01 am

Related Questions

The activity monitor in sql2k8 allows us to see the most expensive queries. Ok,
Sampling with Activity Monitor/Instruments/Shark will show stack traces full of C functions for the
Is there any way to view the activity log for the integrate SourceSafe inside
Are you aware of any tool that creates diagrams showing the branch/merge activity in
I have a web-based application that notifies users of activity on the site via
i have created a workflow activity that do give the item creater of a
Here's the XML file i'm working on: <list> <activity>swimming</activity> <activity>running</activity> <activity>soccer</activity> </list> The index.php,
The CodePlex team has a Slack time policy, and it's worked out very well
The .XFDL file extension identifies XFDL Formatted Document files. These belong to the XML-based
The MSDN documentation on Object.GetHashCode() describes 3 contradicting rules for how the method should

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.