Measuring plan eviction
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
5
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
5
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
5
down vote
favorite
up vote
5
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 Nov 8 at 13:34
Frederik Vanderhaegen
575315
575315
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
6
down vote
accepted
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
6
down vote
accepted
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
6
down vote
accepted
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
6
down vote
accepted
up vote
6
down vote
accepted
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 Nov 8 at 14:04
David Browne - Microsoft
9,676725
9,676725
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
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown