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

  • SEARCH
  • Home
  • 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 7748901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:54:16+00:00 2026-06-01T10:54:16+00:00

I am trying to resolve a 100% cpu usage by the SQL Server process

  • 0

I am trying to resolve a 100% cpu usage by the SQL Server process on the database server. While investigating, I have now come across the fact that the stored procedures are taking the most worker time.

For the following query of dmv’s to find queries taking highest time,

SELECT TOP 20 st.text
               ,st.dbid
               ,st.objectid
               ,qs.total_worker_time
               ,qs.last_worker_time
               ,qp.query_plan
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp
ORDER BY qs.total_worker_time DESC

most of them are stored procedures. The weird thing is that all these stored procedures are querying different tables. And yet they are the top of taking the most worker time, even though when I look at the Profiler for queries with top CPU, Reads, Duration, the stored procedures don’t figure at the top there.

Why could this be happening?

==Edit==
The application actually uses adhoc queries more than stored procedures. Some of these procedures are to be migrated to using adhoc queries. The thing is that these procedures are not called as often as some of the other queries, which are cpu intensive, and are called very frequently.
Also, it does strike me odd that a stored procedure with which does a simple select a,b,c from tbl where id=@id would have a higher total worker time than a query which has mulitple joins, user defined functions in the where clause, a sort and a row_number over and while the simple one queries a table with 20000 records, the complex query is on a table with over 200,000 records.

  • 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. Editorial Team
    Editorial Team
    2026-06-01T10:54:18+00:00Added an answer on June 1, 2026 at 10:54 am

    It depends what are you doing in that stored procedure, how you are tuning your tables, indexes, etc.

    For example if you create a stored procedure using loops like cursor you will have at maximum your cpu usage. If you don’t setup your indexes and you are using select using different joins,etc. You’ll have your cpu overloaded.

    It is accordingly of how you use your database.

    Some tips:

    1. I recommend create stored procedure most of the time.
    2. When you create your stored procedures, run with execution plan to get some suggestions.
    3. If the tables have a lot of records (more than 1 or 2 millions), think about create index views.
    4. Do update or delete only when is necessary, sometimes is better only insert records and run a job daily or weekly to update or remove the records that you don’t need. (it depends of the case)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've come across an issue with ActiveResource that has been resolved and was trying
We've been seeing this problem for a while now and I'm really trying to
I was trying to do this : <asp:GridView ID=gvBugList runat=server AutoGenerateColumns=False ShowHeader=False DataSourceID=linqDSBugList Width=100%
I am having a problem, for a while I have been trying to figure
I'm trying to resolve a hostname in PHP and can't use the builtin gethostbyname
I am going nuts here trying to resolve a cascading update/delete issue :-) I
I'm trying to figure out how to resolve relatively referenced resources inside dynamically loaded
I'm trying to create a patch for cf.vim to resolve an issue with hashes.
I am trying to find a solution that will resolve a recurring deadlock situation
In my efforts to resolve Python issue 1578269 , I've been working on trying

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.