Skip to main content

Posts

Showing posts from July, 2022

MS SQL Server: Query store fix performance issue

Here are some reference links and script I used to fix performance issue by force query plan using query store feature:  --https://docs.microsoft.com/en-us/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store?view=sql-server-ver16 --https://www.sqlshack.com/force-query-execution-plan-using-sql-server-2016-query-store/ --ALTER DATABASE [system-abccompany] SET QUERY_STORE = ON (OPERATION_MODE = READ_WRITE); --ALTER DATABASE [system-abccompany] SET QUERY_STORE = ON ( WAIT_STATS_CAPTURE_MODE = ON ); --SELECT actual_state_desc, desired_state_desc, current_storage_size_mb,    max_storage_size_mb, readonly_reason, interval_length_minutes,    stale_query_threshold_days, size_based_cleanup_mode_desc,    query_capture_mode_desc --FROM sys.database_query_store_options; --select count(*) from sys.query_store_query --ALTER DATABASE [system-abccompany] SET QUERY_STORE (MAX_STORAGE_SIZE_MB =100); --ALTER DATABASE [system-abccompany] SET QUERY_STORE CLEAR; --ALTER DATAB