测试 SQL Server 2008 数据库

发布于 2025-01-07 20:51:27 字数 356 浏览 0 评论 0原文

我有一台具有 32 GB RAM 和 Intel Xeon CPU(2 个 2.4GHz 处理器)的服务器。

SQL Server 2008 正在其上运行,具有 3 或 4 个数据库。

问题是CPU和内存一直在满负荷运行,我最初以为是通过Visual Studio运行的多线程应用程序,但关闭它们后,没有任何变化。有人建议我在 SQL 中进行性能测试,但我不确定这是否能给出我需要的答案。

我查看了活动监视器,可以看到哪些是昂贵的查询等,但我的问题是这些是否足够。我需要向我的主管提供有关导致 CPU 和内存激增的原因的统计信息,以及活动监视器结果是否足够,或者我是否需要使用 SQL Server Profiler 和运行跟踪。任何建议表示赞赏。

I have a server with 32 gigs of RAM and Intel Xeon CPU (2 processors at 2.4GHz).

SQL Server 2008 is running on it with 3 or 4 databases.

The problem is that the CPU and memory has been running at full capacity and I initially thought it was multithreaded applications I was running through Visual Studio, but after shutting these down, nothing has changed. Someone suggested I do performance testing in SQL but I am not sure if this will give the answers I need.

I looked at the activity monitor and I can see which are expensive queries etc. but my question is whether these are sufficient. I need to present to my lead stats on what is causing the spike in CPU and memory and is the activity monitor results enough or do I need to use the SQL Server Profiler and run traces. Any suggestions appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

郁金香雨 2025-01-14 20:51:27

我使用以下查询来找出服务器上最昂贵的查询 - 最初来自 此处

希望有帮助!

SELECT DISTINCT TOP 10 t.TEXT QueryName,
                       s.execution_count AS ExecutionCount,
                       s.max_elapsed_time AS MaxElapsedTime,
                       Isnull(s.total_elapsed_time / s.execution_count, 0) AS AvgElapsedTime,
                       s.creation_time AS LogCreatedOn,
                       Isnull(s.execution_count / Datediff(s, s.creation_time, Getdate()), 0) AS FrequencyPerSec
FROM   sys.dm_exec_query_stats s
       CROSS APPLY sys.Dm_exec_sql_text(s.sql_handle) t
ORDER  BY s.max_elapsed_time DESC

I use the following Query to find out the most expensive queries on my server - originally from here.

Hopefully it helps!

SELECT DISTINCT TOP 10 t.TEXT QueryName,
                       s.execution_count AS ExecutionCount,
                       s.max_elapsed_time AS MaxElapsedTime,
                       Isnull(s.total_elapsed_time / s.execution_count, 0) AS AvgElapsedTime,
                       s.creation_time AS LogCreatedOn,
                       Isnull(s.execution_count / Datediff(s, s.creation_time, Getdate()), 0) AS FrequencyPerSec
FROM   sys.dm_exec_query_stats s
       CROSS APPLY sys.Dm_exec_sql_text(s.sql_handle) t
ORDER  BY s.max_elapsed_time DESC
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文