May 1, 2012
tom

SQL Server Expensive Select Queries from unknown source

Question

When viewing Queries by CPU usage with Performance Dasboard, I notice a great deal of queries like “Select * from dbo.sometable”. What is the best way to go about tracking the source of these queries? Nowhere in my code do I run a select on a full table, but they continue to appear and SQL says they are getting executed ever few minutes. Are these actual queries or is it possible that they are being executed as part of another query, view, or stored procedure? These queries are by far the costliest queries running on my server.

Asked by Barnes

Answer

If you have a SQL job that rebuilds indexes automatically, those jobs will often show their sql_text as SELECT * FROM [table] or INSERT [TABLE] SELECT * FROM [TABLE].

I would get on the DB and run sp_who2 or get a fancier tool that helps you hunt down more about the running processes. Google “sp_whoisactive” for example.

Answered by Mark

Related posts:

  1. Get the average execution time of all select queries
  2. SQL Server queries take forever to enumerate the dataset?
  3. SQL Server blocking queries
  4. will mysqldump lockout select or read only based queries
  5. Monitoring MySQL SELECT/WRITE/UPDATE/SLOW queries in Nagios

Leave a comment