Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

How to cache rows?

$
0
0

Hi

This is my procedure:

                create procedure [dbo].DebugSpTestCache

       @filter nvarchar(100),

       @checkDescription int

as

begin

       if @checkDescription = 1

              execute sp_executesql N'select * from devices where name LIKE ''%'' + @filter + ''%'' or deviceDescription LIKE ''%'' + @filter + ''%''', N'@filter nvarchar(100)', @filter;

       else

              execute sp_executesql N'select * from devices where name LIKE ''%'' + @filter + ''%'' ', N'@filter nvarchar(100)', @filter;

end

In sql profiler I have selected 4 events: SP:CacheHit, SP:CacheInsert, SP:CacheMiss, SP:CacheRemove.

When I call: exec DebugSpTestCache 'aaa', 1 I see that CacheInsert is fired.

When I call : exec DebugSpTestCache 'bbb', 1 I see that CacheInsert is not fired.

Does it mean that only execution plan goes to the cache? I thought that cache can store also rows.

Is it possible to insert into a cache rows?

Regards


kicaj


Viewing all articles
Browse latest Browse all 15889

Trending Articles