Mysql到SQL Server:有没有类似查询缓存的东西?
我正在尝试优化 SQL Server。我对 Mysql 有一些经验,通常有帮助的事情之一是启用查询缓存,只要您运行相同的查询,它基本上就会缓存查询结果。
SQL Server 上有类似的东西吗?您能指出这个功能的名称吗?
谢谢!
I'm trying to optimize a SQL Server. I have some experience with Mysql and one of the things that usually help is to enable query cache, that will basically cache query results as long as you are running the same query.
Is there something similar to this on SQL Server? Could you please point what is the name of this feature?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SQL Server本身并不缓存结果集,但除了缓存查询执行计划之外,它还会缓存已读取的数据页。这意味着,如果它必须再次读取相同的数据页来回答查询,那么速度会更快,因为(从磁盘)物理读取较少,但您仍然应该看到相同数量的逻辑读取。
这里有一篇文章,其中包含更多详细信息。
SQL Server doesn't cache result sets per se, but it does cache data pages which have been read, in addition to caching query execution plans. This means that if it has to read the same data pages again to answer a query, it will be faster since there are fewer physical reads (from disk) but you should still see the same amount of logical reads.
Here is an article with more details.
SQL Server 将缓存查询结果,但它比 MySQL 的情况稍微复杂一些(因为 SQL Server 提供 ACID 保证,而 MySQL 不提供 - 至少 MyISAM 不提供)。但你肯定会发现,第二次在 SQL Server 上执行查询时,它会比第一次更快(只要没有发生其他更改)。
据我所知,此功能没有具体名称。它更像是缓存的组合......
SQL Server will cache query results, but it's a little more complicated than in MySQL's case (since SQL Server provides ACID guarantees that MySQL does not - at least, not with MyISAM). But you'll definitely find that the second time you execute a query on SQL Server, it'll be faster than the first time (as long as no other changes have happened).
There's no specific name for this feature, that I'm aware of. It's more a combination of caches...