I have been running a query on Azure SQL database and the same query is now taking 10 times longer - 4mins up to 40. The datasets are the same and even with ramping up the DTU's, the query time barely changes.
Are there any things I can do to either reset the database to how it was performing or any tips to help out.
Thanks
Related
I have a document management system (like SharePoint), which works on top of Microsoft SQL Server. It generates SQL queries where I do not have much control, so I cannot change SQL queries directly in most of the cases.
In the past, this system was running on top of SQL Server 2014 and performance was ok. Later another instance were created with SQL Server 2017 and performance of some queries is very bad (like 1 minute compare to 0.2 seconds in the past). Query is a select from 8 tables, which are joined by foreign/primary key. It does not make much sense to put query here, because it is 140Kb in size and query execution plan is also huge. I guess nobody will have time to understand and analyze it. My database is not empty and has some data, around 100K records in some tables and up to 4M records in another table, which are joined in this query. The final query result is around 8000 rows. if I add ALL TOP 30 hint, with the value less than 30, then it slows down the query a lot. Any values more than 30 or removing ALL TOP hint does not affect the performance, except time to fetch 8000 rows, but I see the first records very fast.
I tried to switch new server into compatibility mode the same as old one, but it did not help. I found that if I add to the query these hints
OPTION (LOOP JOIN, FORCE ORDER)
then it becomes much faster. If I add one of these hints it does not help.
I cannot modify the queries generated by the system, which means I cannot add these hints to every query it generates. I only extracted query from trace and add hints for debugging purposes, when running them in SQL Server Management Studio.
My question:
Can this fact, that adding these 2 hints improve the performance tell me something about what is wrong in my SQL Server and gives some ideas what I can change in the SQL Server configuration to improve performance?
We've enabled query trace in our production database to investigate some performance problems (Microsoft SQL Server 2016 (SP2) (KB4052908)). While tracking executed queries from query trace, it seems to me like these execution count totals are way off. Attaching a snippet of counts for one minute. I've also looked at the Dynatrace DB call numbers and they seem more accurate to me. Wondering if its incorrect of if I'm looking at this wrong.
Dynatrace screenshot contains 5 mins of data as its the minimum allowed threshold.
Looks like it confuses the data set.
Same query, different response below...
I tried to use Azure SQL Database with Tableau for visualizing data. First issue was that Tableau takes a huge time on connecting to db on start (about 10-30 minutes). After connecting it works fast. I provided some investigations and determined that the same situation happens when I try to expand tables list of database in Sql Server Management studio and then I run SELECT * FROM INFORMATION_SCHEMA.TABLES and have execution time ~10 min. Count of tables in db = 63. Tests was performed at single connection to db, so there was'nt any processes that can lock server and all another queries works fine.
Any ideas what exactly can affect so bad to performance?
There could be many reasons for slowness:
Your Azure SQL Database could be in lower performance tier
You might be located very far from your Azure SQL data center. Try to move the Azure SQL to a data center closer to your location
Please refer to link for any issues related to network latency: https://blogs.msdn.microsoft.com/azuresqldbsupport/2017/10/02/how-to-troubleshoot-slow-performance-after-moving-to-azure-due-to-network-latency/
Had a situation on a Client's MS SQL Server (2014) instance yesterday evening when a SP that was being queried by an application suddenly started timing out even though it had completed previously. My thought is that the Explain Plan for the query was somehow altered and it wasn't until I allowed the application to complete the query that a new explain plan was created.
As far as I am aware there are only two reasons an explain plan would need change:
The SP is recompiled
The database is restarted
Is there an other reason for the Explain Plan to change or is there another reason for a SP query suddenly starting to time out?
We have do migrate data from another huge db to our db using tons of sql scripts. To do this a fast way, we drop most of all indexes from our destination db.
Now, in a not repeatable way, some queries tending to run for minutes an hours instead of minutes. It are not always the same queries. If we stop the hole migration for a time, and then repeat the query, it runs fast again.
So it seems, sql server sometimes chooses wrong execution paths or is having other problems. How should we approach this problem?