SQL Server 2000 缓存

发布于 2024-11-30 11:47:30 字数 262 浏览 0 评论 0原文

我有一个问题,为了加快SQL Server 2000的速度。

我想使用缓存机制,但我不知道如何使用。

我找到了一些关于它的文章,但是你能举一个如何使用的例子吗?

例如:

有一个存储过程 - sp_stackOverFlow - 当每个用户进入程序/网站时它都会执行,很明显它会使运行速度变慢。

有没有办法每 2 分钟或每隔 2 分钟缓存一次 sp_stackOverFlow

I have one question in order to speed up SQL Server 2000.

I want to use caching mechanism, but I don't know how to use.

I found some articles about it, but can you give an example for how to use.

For example:

there is a stored procedure - sp_stackOverFlow - it executes when every user enter to the program/web site and it is clear it makes slower running.

Is there a way of caching sp_stackOverFlow in every 2 minutes or another?

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

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

发布评论

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

评论(1

深空失忆 2024-12-07 11:47:31

您的问题不清楚,尤其是因为存储过程的作用并不明显。如果每次执行和/或用户的结果都不同,那么无论如何都无法轻松缓存它们。

但更根本的是,“我有一个缓慢的存储过程”并不自动意味着“我需要缓存”;数据库引擎本身已经尽可能缓存数据。您需要了解存储过程运行缓慢的原因:硬件性能不足、TSQL 代码不佳、数据模型设计不佳和索引编制不佳都是非常常见的问题,会对性能产生重大影响。

您可以在此站点上以及通过 Google 搜索找到有关如何解决过程执行速度缓慢问题的大量信息,但您可以首先在查询分析器中查看过程的执行计划并使用 Profiler 跟踪执行情况。这将立即告诉您哪些语句花费的时间最多,是否发生表扫描等。

由于性能故障排除可能很复杂,因此如果您需要更多帮助,请发布有关各个问题的简短具体问题。如果您的存储过程的代码非常短(小于 30 行格式),人们可能愿意直接对其进行评论,否则最好只发布导致问题的各个 SQL 语句。

最后,对 MSSQL 2000 的主流支持已于 3 年前停止,因此您绝对应该考虑升级到更新版本。新版本中的性能工具将使解决您的问题变得更加容易。

Your question isn't clear, not least because it isn't obvious what the stored procedure does. If the results are different for every execution and/or user then they cannot easily be cached anyway.

But more fundamentally, "I have a slow stored procedure" does not automatically mean "I need caching"; the database engine itself already caches data when it can. You need to understand why the stored procedure is running slowly: underpowered hardware, poor TSQL code, poor data model design and poor indexing are all very common issues that have major effects on performance.

You can find a lot of information on this site and by Googling about how to troubleshoot slow execution times for procedures, but you can start by reviewing the execution plan for the procedure in Query Analyzer and tracing the execution using Profiler. That will immediately tell you which statements are taking the most time, if there are table scans happening etc.

Because performance troubleshooting is potentially complex, if you need more assistance please post short, specific questions about individual issues. If the code for your stored procedure is very short (< 30 lines formatted) people may be willing to comment on it directly, otherwise it would be better to post only the individual SQL statements that are causing a problem.

Finally, mainstream support for MSSQL 2000 stopped 3 years ago, so you should definitely look into upgrading to newer version. The performance tools in newer versions will make resolving your issue much easier.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文