Measuring plan eviction

Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
4
down vote
favorite
We have a SQL Server 2016 SP1 with max memory set to 24GB.
This server has a high numbers of compiles, only 10% of these compiles are from Ad-Hoc queries. So the newly compiled plans should be stored in the plan cache but the size of the plan cache is not increasing (approx 3.72GB).
I suspect that there is local memory pressure that lead to removal of plans from the cache. The plan cache pressure limit is 5GB. (75% of visible target memory from 0-4GB + 10% of visible target memory from 4GB-64GB + 5% of visible target memory>64GB). When a cachestore reaches 75% of the pressure limit, plans should be removed from the cache. In my case 75% of 5 GB is 3.75GB. So it is plausible this is the cause of the high compiles.
Is there a way to measure (perfmon, extended events, ...) the removal from plans out of the cache? So I can be certain local memory pressure is really the cause of the high compiles?
sql-server-2016 database-internals plan-cache
add a comment |Â
up vote
4
down vote
favorite
We have a SQL Server 2016 SP1 with max memory set to 24GB.
This server has a high numbers of compiles, only 10% of these compiles are from Ad-Hoc queries. So the newly compiled plans should be stored in the plan cache but the size of the plan cache is not increasing (approx 3.72GB).
I suspect that there is local memory pressure that lead to removal of plans from the cache. The plan cache pressure limit is 5GB. (75% of visible target memory from 0-4GB + 10% of visible target memory from 4GB-64GB + 5% of visible target memory>64GB). When a cachestore reaches 75% of the pressure limit, plans should be removed from the cache. In my case 75% of 5 GB is 3.75GB. So it is plausible this is the cause of the high compiles.
Is there a way to measure (perfmon, extended events, ...) the removal from plans out of the cache? So I can be certain local memory pressure is really the cause of the high compiles?
sql-server-2016 database-internals plan-cache
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
We have a SQL Server 2016 SP1 with max memory set to 24GB.
This server has a high numbers of compiles, only 10% of these compiles are from Ad-Hoc queries. So the newly compiled plans should be stored in the plan cache but the size of the plan cache is not increasing (approx 3.72GB).
I suspect that there is local memory pressure that lead to removal of plans from the cache. The plan cache pressure limit is 5GB. (75% of visible target memory from 0-4GB + 10% of visible target memory from 4GB-64GB + 5% of visible target memory>64GB). When a cachestore reaches 75% of the pressure limit, plans should be removed from the cache. In my case 75% of 5 GB is 3.75GB. So it is plausible this is the cause of the high compiles.
Is there a way to measure (perfmon, extended events, ...) the removal from plans out of the cache? So I can be certain local memory pressure is really the cause of the high compiles?
sql-server-2016 database-internals plan-cache
We have a SQL Server 2016 SP1 with max memory set to 24GB.
This server has a high numbers of compiles, only 10% of these compiles are from Ad-Hoc queries. So the newly compiled plans should be stored in the plan cache but the size of the plan cache is not increasing (approx 3.72GB).
I suspect that there is local memory pressure that lead to removal of plans from the cache. The plan cache pressure limit is 5GB. (75% of visible target memory from 0-4GB + 10% of visible target memory from 4GB-64GB + 5% of visible target memory>64GB). When a cachestore reaches 75% of the pressure limit, plans should be removed from the cache. In my case 75% of 5 GB is 3.75GB. So it is plausible this is the cause of the high compiles.
Is there a way to measure (perfmon, extended events, ...) the removal from plans out of the cache? So I can be certain local memory pressure is really the cause of the high compiles?
sql-server-2016 database-internals plan-cache
sql-server-2016 database-internals plan-cache
asked 54 mins ago
Frederik Vanderhaegen
556315
556315
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
There's an XEvent for that:
query_cache_removal_statistics
Occurs when a query plan is removed from the plan cache and the
historical statistics for the object are about to be destroyed
So something like:
CREATE EVENT SESSION [PlanCacheEvictions] ON SERVER
ADD EVENT sqlserver.query_cache_removal_statistics(
ACTION(sqlserver.sql_text))
Also if your plan cache has a large number of single-use plans consider setting optimize for ad hoc workloads.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
There's an XEvent for that:
query_cache_removal_statistics
Occurs when a query plan is removed from the plan cache and the
historical statistics for the object are about to be destroyed
So something like:
CREATE EVENT SESSION [PlanCacheEvictions] ON SERVER
ADD EVENT sqlserver.query_cache_removal_statistics(
ACTION(sqlserver.sql_text))
Also if your plan cache has a large number of single-use plans consider setting optimize for ad hoc workloads.
add a comment |Â
up vote
3
down vote
There's an XEvent for that:
query_cache_removal_statistics
Occurs when a query plan is removed from the plan cache and the
historical statistics for the object are about to be destroyed
So something like:
CREATE EVENT SESSION [PlanCacheEvictions] ON SERVER
ADD EVENT sqlserver.query_cache_removal_statistics(
ACTION(sqlserver.sql_text))
Also if your plan cache has a large number of single-use plans consider setting optimize for ad hoc workloads.
add a comment |Â
up vote
3
down vote
up vote
3
down vote
There's an XEvent for that:
query_cache_removal_statistics
Occurs when a query plan is removed from the plan cache and the
historical statistics for the object are about to be destroyed
So something like:
CREATE EVENT SESSION [PlanCacheEvictions] ON SERVER
ADD EVENT sqlserver.query_cache_removal_statistics(
ACTION(sqlserver.sql_text))
Also if your plan cache has a large number of single-use plans consider setting optimize for ad hoc workloads.
There's an XEvent for that:
query_cache_removal_statistics
Occurs when a query plan is removed from the plan cache and the
historical statistics for the object are about to be destroyed
So something like:
CREATE EVENT SESSION [PlanCacheEvictions] ON SERVER
ADD EVENT sqlserver.query_cache_removal_statistics(
ACTION(sqlserver.sql_text))
Also if your plan cache has a large number of single-use plans consider setting optimize for ad hoc workloads.
answered 23 mins ago
David Browne - Microsoft
9,581725
9,581725
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f222091%2fmeasuring-plan-eviction%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
