简体   繁体   English

SSMS 2012本地实例缓慢

[英]SSMS 2012 local instance slow

I'm encountering an issue with my local instance of SSMS 2012, where it has suddenly started running extremely slowly. 我在本地SSMS 2012实例中遇到问题,该实例突然开始运行非常缓慢。 I have queries that would usually take 20-30 seconds now taking 6+ minutes. 我的查询通常需要20到30秒,现在需要6分钟以上。 These aren't necessarily complex, just a simple join. 这些不一定复杂,只是简单的连接。 I should note that working on a single database performs as normal (as far as my limited tests show) 我应该注意,在单个数据库上工作可以正常进行(据我有限的测试显示)

The only changes I've made recently, is connecting to R using ODBC with the ODBC Driver 11 for SQL Server, straight from Microsoft's website. 我最近所做的唯一更改是直接从Microsoft网站通过ODBC和用于SQL Server的ODBC Driver 11使用ODBC连接到R。

I've tried deleting my ODBC connections, closing RStudio, closing SSMS and even restarted my laptop to sever any remaining connections - all to no avail. 我尝试删除ODBC连接,关闭RStudio,关闭SSMS,甚至重新启动我的笔记本电脑以切断所有剩余的连接-均无济于事。

Any help at this point would be appreciated, thanks. 感谢您在这一点上的任何帮助。

Perhaps your statistics are out of date as that can cause a query that's run okay, to go downhill if there has been a lot of change in the database. 也许您的统计信息已过时,因为这可能导致查询正常运行,如果数据库中发生了很多更改,查询就会下坡。 You can update them using: 您可以使用以下方法更新它们:

EXEC sp_updatestats;

Hopefully this will help. 希望这会有所帮助。 Also another thing to check is that your indexes aren't fragmented. 另外要检查的一件事是您的索引没有碎片。

SELECT dbschemas.[name] as 'Schema', 
dbtables.[name] as 'Table', 
dbindexes.[name] as 'Index',
indexstats.avg_fragmentation_in_percent,
indexstats.page_count
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS indexstats
INNER JOIN sys.tables dbtables on dbtables.[object_id] = indexstats.[object_id]
INNER JOIN sys.schemas dbschemas on dbtables.[schema_id] = dbschemas.[schema_id]
INNER JOIN sys.indexes AS dbindexes ON dbindexes.[object_id] = indexstats.[object_id]
AND indexstats.index_id = dbindexes.index_id
WHERE indexstats.database_id = DB_ID()
ORDER BY indexstats.avg_fragmentation_in_percent desc

This will show a list of the objects in the current database. 这将显示当前数据库中的对象列表。 (Use a use statement to choose the database before running) (在运行之前使用use语句选择数据库)

Use Northwind
GO

Anything that is more than 5% then use ALTER INDEX IndexName REBUILD 任何大于5%的值,然后使用ALTER INDEX IndexName REBUILD

Anything that is more than 30% then use a ALTER INDEX IndexName REBUILD 大于30%的内容则使用ALTER INDEX IndexName REBUILD

This could take some time! 这可能需要一些时间!

hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM