简体   繁体   English

如何在Sybase ASE中清除缓存

[英]How to Clear Cache in Sybase ASE

I want to clear the cache of Sybase ASE, so that I can test always the worst case scenario in two different queries. 我想清除Sybase ASE的缓存,以便始终可以在两个不同的查询中测试最坏的情况。

What I found in my research was to use the commands below to clear cache, and sp_helpcache to check objects cached: 我在研究中发现的是,使用以下命令清除缓存,并使用sp_helpcache检查缓存的对象:

sp_unbindcache <dbname>, <table>
sp_unbindcache_all <cache name>

How did I tested it? 我是如何测试的?

I ran a SELECT Count on a table before and after running sp_unbindcache and the second test was to run the query before and after sp_unbindcache_all 我在运行sp_unbindcache之前和之后在表上运行SELECT Count,第二个测试是在sp_unbindcache_all之前和之后运行查询

What happened? 发生了什么?

The first time I ran the query there was physical I/O the subsequent tries did not, only Logical I/O. 第一次运行查询时,存在物理I / O,但随后的尝试没有,只有逻辑I / O。 (Cache preserved despite running the unbindcache commands) (尽管运行了unbindcache命令,仍保留了缓存)

Weird Stuff 奇怪的东西

When I ran sp_helpcache it didn't show my table on the list of objects in Cache Binding Information (CBI). 当我运行sp_helpcache时,它没有在高速缓存绑定信息(CBI)中的对象列表上显示我的表。 After running sp_unbindcache_all, sp_helpcache showed no rows on CBI. 运行sp_unbindcache_all后,sp_helpcache在CBI上未显示任何行。 I then re-run the query and sp_helpcache was still with CBI empty. 然后,我重新运行查询,并且sp_helpcache仍然CBI为空。 This is weird because it might mean that when I run a query, my table is cache somewhere else. 这很奇怪,因为这可能意味着当我运行查询时,我的表被缓存在其他地方。

The Question 问题

So I would Like to know how can I find where my table is being cached when I run a query, and then how can I clear it from there? 因此,我想知道在运行查询时如何找到表的缓存位置,然后如何从那里清除它?

Other Info 其他资讯

Database: SYBASE ASE 15.7 数据库:SYBASE ASE 15.7

sp_helpcache only shows "default data cache" sp_helpcache仅显示“默认数据缓存”

Cache Binding Information(CBI) - is part of sp_helpcache's output 缓存绑定信息(CBI)-是sp_helpcache输出的一部分

UPDATE: 更新:

I Have made a new test where I Bind the table to the "default data cache" to see if it would appear in CBI and it appeared. 我做了一个新测试,将表绑定到“默认数据缓存”,以查看它是否会出现在CBI中并出现。

Sp-helpcache only shows the bindings, not what's in the cache. Sp-helpcache仅显示绑定,而不显示缓存中的内容。 For that , you can use some of the MDA tables. 为此,您可以使用一些MDA表。 To clear the cache, binding and unbinding a table (or database) will do the job. 要清除缓存,可以对表(或数据库)进行绑定和取消绑定。 Of course, rebooting ASE also will. 当然,重新启动ASE也会。

  • To clear cache in "default data cache" you should use dbcc cachedataremove 要清除“默认数据缓存”中的缓存,应使用dbcc cachedataremove
  • for user defined cache you should use sp_unbindcache , or sp_unbindcache_all 对于用户定义的缓存,应使用sp_unbindcache或sp_unbindcache_all

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

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