In certain periods, we are seeing slow queries on our SQL Server 2012 instance (on an Azure VM).
When analysing these queries (execution plan), there is nothing obvious wrong with the plan, and running them in management studio yields instant results.
My guess here is that there is lock contention issues.
My question is: how can i get better insights into why these queries are running slow?
Is there a third-party tool that's great for this job? (e.g Redgate SQL monitor)
From experience, the built-in SQL queries/tools that help diagnose these sorts of issues aren't very easy to use (manual queries, deadlock graphs, etc).
Can anyone point me in the right direction of either a great tool i can use, or a simple way within SQL Server to find out why they are running slow.
Thanks!
The best "free" tool that I've found is Blitz tools provide by Brent Ozar (part of first responder kit) found here.
With these tools, you should be able to spot a problem very quickly, and sp_blitzindex will give all kinds of info on indexes. You can automate/notify as you see fit.
Related
For testing purposes, is there a way to slow down all SQL queries? There are ways to slow down specific queries but is there a way to slow down ALL queries?
Ideally it would be nice to have a simple way to say, all queries by [N] milliseconds.
Sloppier ways might include...
- Lower SQL Server's available memory
- Loop through other SQL statements to have an artificial load
- Create/run a seperate CPU/IO/Memory heavy process on the SQL server
However... these seem very rough and not very elegant all. Is there something more exacting?
There's actually a tool which was created for this purpose, aptly name, SQL Query Stress. It's available on Github.
Github link: https://github.com/ErikEJ/SqlQueryStress
I've been introduced to it by Brent Ozar and company. Please see the link to the article in which he introduces it and shows some of its use.
https://www.brentozar.com/archive/2015/05/how-to-fake-load-tests-with-sqlquerystress/
As per the requirement I need to know is there any design tool available for SQL Server 2014 .
Also I want to more Explore the performance Tuning and optimization for written code.
If you're looking for free tools then Windows 'Performance Monitor' is pretty helpful. You can add the specific counters that you want to monitor and keep track of them. There is a simple 'how to' guide here that will show you how you can store them a SQL Server instance then you can manipulate it how you want.
For performance tuning queries, it comes with practice. Find some poor queries and then look at the execution plan and see what its doing. There are many free videos that you can watch that will help you understand what it shows.
I'm experiencing periodical Azure SQL Database connection slow downs. As recommended in Wait statistics, or please tell me where it hurts article I ran sys.dm_db_wait_stats (analogue of sys.dm_os_wait_stats for Azure SQL Database) aggregation script which show me that longest waits are of type XE_FILE_TARGET_TVF. Average wait time is 54 seconds.
XE_FILE_TARGET_TVF didn't mentioned in documentation as in any other online resources that I know. I suspect that "XE" means "Extended Events", "TVF" is "table-valued functions", "FILE_TARGET" is probably indicator that something is being written to some file.
So, what kind of wait it is?
Use Azure SQL Database Query Performance Insight for troubleshooting SQL Azure DBs. To begin with, wait stats alone are not a correct performance troubleshooting approach. Read How to analyse SQL Server performance for a more thorough approach, learn to analyze also where the CPU is spent, not only where the elapsed time is spent waiting. Aggregate wait stats are often misleading, filtering out the 'benign' wait stats is a chasing the red lights game.
Unfortunately not everything is actionable in SQL Azure DB environment. Start with the Query Performance Insight to see if you can correlate the performance issues with queries issued by your app. Use the SQL Database Index Advisor to get index recommendations for your workload.
If you cannot find the application problems and suspect this is caused by the platform, you will have to open a support case. Twitting #AzureSupport is very effective in getting help.
To answer your question: a lot of Azure SQL DB monitoring relies on Extended Events and they store data to files. This specific wait stat is unlikely to be related to the cause of your performance problems.
I believe that it's a async process so possibly nothing to worry around and could be a red herring. However I think this is a fabric related task behind the DB. Does this event seem to be consistently causing you issues?
I have a Report Server that runs SSRS 2008 R2 Standard. This server retrieves data from another SQL Server 2008 R2 (Standard again). I want to manage the query priority on these SQL Standard servers, in a manner similar to Resource Governor.
Resource Governor is an Enterprise-only feature and I cannot afford to upgrade to that edition at the moment. Can you suggest an approach/tool to achieve this, even just to some basic degree: Account-based, CPU usage, query time-out?
It's possible to run a job that scans currently running tasks and tracks which ones are blocking or hogging resources. You can then kill different spids based on your own criteria. What that criteria is depends on your own business needs.
I hate to give the advice of "Google this", but there are several tools that can do this, each with varying levels of customization available or you can roll your own. The code for rolling your own can get a little complex. Anyway, if you Google "sql block monitor" or "sql spid monitor" you should find several possible solutions.
These solutions typically do not take into account CPU and/or memory though as the Resource Governor does. You can look at the actual code being run though (hopefully stored procedure calls) and base your decisions on that. From the description of your problem it seems like that might be what you're looking to do.
EDIT: Would this be better as a wiki, since it doesn't have a definitive answer? It could then serve as a collection of the various solutions which exist. Perhaps someone more involved in the SO site can comment on that.
I'm in a situation where I came into a new job and I have to support several legacy systems. The original developer is no longer around. These legacy systems are really hammering away at our SQL Server and killing performance. I know that there are a lot of things that can be done in the code, but rewriting code is really my last resort.
What I'm looking for is some sort of tool that will monitor the queries coming into the server and give recommendations on indexing solutions. I know I can use the SQL Server Profiler but I'm looking for something a little more user friendly and something that can help me make the indexing decisions.
I know I didn't explain it very well, but I'm sure this is a common request. I'd like to make informed decisions on what to index and avoid "shooting from the hip" and indexing everything in sight. Thanks for any recommendations!
You don't need a third party tool for this.
Assuming SQL Server 2005+ as long as you can use SQL Profiler (actually SQL Trace - Don't use the Profiler GUI for this to reduce tracing overhead as much as possible) to collect a representative workload you can use the Database Tuning Advisor to automate analysis of the workload and make indexing recommendations.
You can also use the Missing Index DMVs for a quick overview of areas to investigate but the DTA will do more holistic analysis and take into account possible adverse effects of indexes on data modification statements.
+1 for Martin's answer, but since you asked about 3rd party tools, I'll mention one of my favorites (and no, I don't work for the company). Ignite for SQL Server does an excellent job of analyzing server activity in terms of wait time analysis. It won't make recommendations for you, but it will quickly identify the worst performing queries where you need to focus your effort.
SQL Server 2005+ has a lot of DMV's (Dynamic Management views) that you can query to get server info, as well as the Profiler / SQL Trace tool.
We administer several large database servers.
Idera is a good tool to manage multiple database servers easily.
I think you'd make a much better DBA if you learn more about the inbuilt functionality of SQL server.
Have a browse of
http://msdn.microsoft.com/en-us/library/ms188754.aspx
to find out more about DMV's and functions.
Another common issue with performance could be your indexes.
Theres a great tutorial that combines the DMV's with improving indexes here:
http://searchsqlserver.techtarget.com/tip/Using-dynamic-management-views-to-improve-SQL-Server-index-effectiveness
Idera is really worth checking out though as a good starting point. Combined with DMV's & SQL trace there shouldn't be much you won't be able to fix.
Idera just takes most of the leg work out of doing things.
http://www.idera.com/Content/Home.aspx
Idera: SQL Diagnostic Manager