20. Query Store

2016+: Query history, plans, statistics at DB level

ALTER DATABASE db SET QUERY_STORE=ON;
QUERY_CAPTURE_POLICY
STALE_CAPTURE_THRESHOLD
EXECUTION_COUNT
TOTAL_COMPILE_CPU_TIME_MS
TOTAL_EXECUTION_CPU_TIME_MS

query_store_plan
query_store_query
query_store_wait_stats
query_store_query_stats
query_store_runtime_stats

sp_query_store_flush_db
sp_query_store_force_plan
sp_query_store_unforce_plan
sp_query_store_reset_exec_stats
sp_query_store_remove_plan
sp_query_store_remove_query

2019+ more granular control over capture