是否可以在SELECT上定义一个Notification,但以这种方式:只有在select中写入的列发生更改时,Broker才会重置Cache.因此,列敏感方法.如果表中的一些不重要的列被更改,我不希望缓存重置.我将使用INNER JOIN进行SELECT.
Is it possible to define a Notification on SELECT, but in that way: the Broker would reset Cache only if columns written in select has changed. So Column Sensitive approach. I don't want the cache resets if some unimportant column in the table are changed. I will have a SELECT with INNER JOIN.
预先感谢您的帮助.
推荐答案理论认为,如果将SELECT列限制为仅包含感兴趣的列,则仅当这些列发生更改时才应通知您.但是了解查询通知的发生时间出现此警告:
The theory goes that if you restrict your SELECT columns to contain only the columns of interest, you should be notified only if those columns changed. However the Understanding When Query Notifications Occur has this warning:
请注意,SQL Server可能会生成查询通知以响应 不会更改数据的事件,或响应于更改的事件 实际上并不会影响查询结果.例如,当 UPDATE语句更改查询返回的行之一, 即使该行的更新未更改 查询结果中的列.
Notice that SQL Server may produce a query notification in response to events that do not change the data, or in response to a change that does not actually affect the results of the query. For example, when an UPDATE statement changes one of the rows returned by the query, the notification may fire even if the update to the row did not change the columns in the query results.
因此,您将得到误报.
更多推荐
通过Service Broker通知的SqlCacheDependency
发布评论