sys.database_query_store_options (Transact-SQL)sys.database_query_store_options (Transact-SQL)
Si applica a:Applies to: SQL Server 2016 (13.x)SQL Server 2016 (13.x)
SQL Server 2016 (13.x)SQL Server 2016 (13.x) e versioni successive
database SQL di AzureAzure SQL Database
database SQL di AzureAzure SQL Database
Istanza gestita di SQL di AzureAzure SQL Managed Instance
Istanza gestita di SQL di AzureAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse AnalyticsSi applica a:Applies to:
SQL Server 2016 (13.x)SQL Server 2016 (13.x)
SQL Server 2016 (13.x)SQL Server 2016 (13.x) and later
database SQL di AzureAzure SQL Database
database SQL di AzureAzure SQL Database
Istanza gestita di SQL di AzureAzure SQL Managed Instance
Istanza gestita di SQL di AzureAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Restituisce le opzioni di Query Store per il database.Returns the Query Store options for this database.
Si applica a: SQL ServerSQL Server (SQL Server 2016 (13.x)SQL Server 2016 (13.x) e versioni successive), Database SQLSQL Database.Applies to: SQL ServerSQL Server (SQL Server 2016 (13.x)SQL Server 2016 (13.x) and later), Database SQLSQL Database.
Nome colonnaColumn name | Tipo di datiData type | DescrizioneDescription |
---|---|---|
desired_statedesired_state | smallintsmallint | Indica la modalità operativa desiderata di Query Store, impostata in modo esplicito dall'utente.Indicates the desired operation mode of Query Store, explicitly set by user. 0 = OFF0 = OFF 1 = READ_ONLY1 = READ_ONLY 2 = READ_WRITE2 = READ_WRITE |
desired_state_descdesired_state_desc | nvarchar(60)nvarchar(60) | Descrizione testuale della modalità operativa desiderata di Query Store:Textual description of the desired operation mode of Query Store: OFFOFF READ_ONLYREAD_ONLY READ_WRITEREAD_WRITE |
actual_stateactual_state | smallintsmallint | Indica la modalità operativa di Query Store.Indicates the operation mode of Query Store. Oltre all'elenco degli stati desiderati richiesti dall'utente, lo stato effettivo può essere uno stato di errore.In addition to list of desired states required by the user, actual state can be an error state. 0 = OFF0 = OFF 1 = READ_ONLY1 = READ_ONLY 2 = READ_WRITE2 = READ_WRITE 3 = ERRORE3 = ERROR |
actual_state_descactual_state_desc | nvarchar(60)nvarchar(60) | Descrizione testuale della modalità operativa effettiva di Query Store.Textual description of the actual operation mode of Query Store. OFFOFF READ_ONLYREAD_ONLY READ_WRITEREAD_WRITE ERROREERROR Esistono situazioni in cui lo stato effettivo è diverso dallo stato desiderato:There are situations when actual state is different from the desired state: -Se il database è impostato sulla modalità di sola lettura o se Query Store dimensione supera la quota configurata, Query Store possibile operare in modalità di sola lettura anche se l'utente ha specificato la lettura/scrittura.- If the database is set to read-only mode or if Query Store size exceeds its configured quota, Query Store may operate in read-only mode even if read-write was specified by the user. -In scenari estremi Query Store possibile immettere uno stato di errore a causa di errori interni.- In extreme scenarios Query Store can enter an ERROR state because of internal errors. A partire da SQL Server 2017 (14.x)SQL Server 2017 (14.x) , in questo caso, è possibile recuperare query Store eseguendo la sp_query_store_consistency_check stored procedure nel database interessato.Starting with SQL Server 2017 (14.x)SQL Server 2017 (14.x), if this happens, Query Store can be recovered by executing the sp_query_store_consistency_check stored procedure in the affected database. Se sp_query_store_consistency_check l'esecuzione non funziona o se si utilizza SQL Server 2016 (13.x)SQL Server 2016 (13.x) , sarà necessario cancellare i dati eseguendo ALTER DATABASE [YourDatabaseName] SET QUERY_STORE CLEAR ALL; If running sp_query_store_consistency_check doesn't work, or if you are using SQL Server 2016 (13.x)SQL Server 2016 (13.x), you will need to clear the data by running ALTER DATABASE [YourDatabaseName] SET QUERY_STORE CLEAR ALL; |
readonly_reasonreadonly_reason | intint | Quando il desired_state_desc viene READ_WRITE e il actual_state_desc è READ_ONLY, readonly_reason restituisce un mapping di bit per indicare perché il query Store è in modalità di sola lettura.When the desired_state_desc is READ_WRITE and the actual_state_desc is READ_ONLY, readonly_reason returns a bit map to indicate why the Query Store is in readonly mode. 1 -il database è in modalità di sola lettura1 - database is in read-only mode 2 -il database è in modalità utente singolo2 - database is in single-user mode 4 -il database è in modalità di emergenza4 - database is in emergency mode 8 : il database è una replica secondaria (si applica a always on e alla database SQL di AzureAzure SQL Database replica geografica).8 - database is secondary replica (applies to Always On and database SQL di AzureAzure SQL Database geo-replication). Questo valore può essere osservato in modo efficace solo nelle repliche secondarie leggibiliThis value can be effectively observed only on readable secondary replicas 65536 : il query Store ha raggiunto il limite di dimensioni impostato dall' MAX_STORAGE_SIZE_MB opzione.65536 - the Query Store has reached the size limit set by the MAX_STORAGE_SIZE_MB option. Per ulteriori informazioni su questa opzione, vedere Opzioni ALTER database set (Transact-SQL).For more information about this option, see ALTER DATABASE SET options (Transact-SQL).131072 : il numero di istruzioni diverse in query Store ha raggiunto il limite di memoria interna.131072 - The number of different statements in Query Store has reached the internal memory limit. Provare a rimuovere le query che non sono necessarie o ad eseguire l'aggiornamento a un livello di servizio superiore per consentire il trasferimento di Query Store in modalità di lettura/scrittura.Consider removing queries that you do not need or upgrading to a higher service tier to enable transferring Query Store to read-write mode. 262144 : le dimensioni degli elementi in memoria in attesa di essere mantenute sul disco hanno raggiunto il limite di memoria interna.262144 - Size of in-memory items waiting to be persisted on disk has reached the internal memory limit. Query Store sarà temporaneamente in modalità di sola lettura finché gli elementi in memoria non vengono salvati in modo permanente su disco.Query Store will be in read-only mode temporarily until the in-memory items are persisted on disk. 524288 : il database ha raggiunto il limite di dimensioni del disco.524288 - Database has reached disk size limit. Query Store fa parte del database utente, pertanto se non è più disponibile spazio per un database, significa che non è più possibile aumentare ulteriormente Query Store.Query Store is part of user database, so if there is no more available space for a database, that means that Query Store cannot grow further anymore. Query Store per tornare alla modalità di lettura/scrittura, vedere verificare query Store sta raccogliendo i dati delle query in modo continuativo nella procedura consigliata con il query Store.To switch the Query Store operations mode back to read-write, see Verify Query Store is Collecting Query Data Continuously section of Best Practice with the Query Store. |
current_storage_size_mbcurrent_storage_size_mb | bigintbigint | Dimensioni del Query Store su disco in megabyte.Size of Query Store on disk in megabytes. |
flush_interval_secondsflush_interval_seconds | bigintbigint | Periodo di Scaricamento normale dei dati di Query Store su disco in secondi.The period for regular flushing of Query Store data to disk in seconds. Il valore predefinito è 900 (15 min).Default value is 900 (15 min). Modificare utilizzando l' ALTER DATABASE <database> SET QUERY_STORE (DATA_FLUSH_INTERVAL_SECONDS = <interval>) istruzione.Change by using the ALTER DATABASE <database> SET QUERY_STORE (DATA_FLUSH_INTERVAL_SECONDS = <interval>) statement. |
interval_length_minutesinterval_length_minutes | bigintbigint | Intervallo di aggregazione delle statistiche in minuti.The statistics aggregation interval in minutes. Non sono consentiti valori arbitrari.Arbitrary values are not allowed. Usare uno dei seguenti: 1, 5, 10, 15, 30, 60 e 1440 minuti.Use one of the following: 1, 5, 10, 15, 30, 60, and 1440 minutes. Il valore predefinito è 60 minuti.The default value is 60 minutes. |
max_storage_size_mbmax_storage_size_mb | bigintbigint | Dimensioni massime del disco per il Query Store in megabyte (MB).Maximum disk size for the Query Store in megabytes (MB). Il valore predefinito è 100 MB fino a SQL Server 2017 (14.x)SQL Server 2017 (14.x) e 1 GB a partire da SQL Server 2019 (15.x)SQL Server 2019 (15.x) .Default value is 100 MB up to SQL Server 2017 (14.x)SQL Server 2017 (14.x), and 1 GB starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x) . Per l' Database SQLSQL Database edizione Premium, il valore predefinito è 1 GB e per l' Database SQLSQL Database edizione Basic, il valore predefinito è 10 MB.For Database SQLSQL Database Premium edition, default is 1 GB and for Database SQLSQL Database Basic edition, default is 10 MB. Modificare utilizzando l' ALTER DATABASE <database> SET QUERY_STORE (MAX_STORAGE_SIZE_MB = <size>) istruzione.Change by using the ALTER DATABASE <database> SET QUERY_STORE (MAX_STORAGE_SIZE_MB = <size>) statement. |
stale_query_threshold_daysstale_query_threshold_days | bigintbigint | Numero di giorni per cui le informazioni per una query vengono mantenute nella Query Store.Number of days that the information for a query is kept in the Query Store. Il valore predefinito è 30.Default value is 30. Impostare su 0 per disabilitare i criteri di conservazione.Set to 0 to disable the retention policy. Per l'edizione Database SQLSQL Database Basic, l'impostazione predefinita è 7 giorni.For Database SQLSQL Database Basic edition, default is 7 days. Modificare utilizzando l' ALTER DATABASE <database> SET QUERY_STORE ( CLEANUP_POLICY = ( STALE_QUERY_THRESHOLD_DAYS = <value> ) ) istruzione.Change by using the ALTER DATABASE <database> SET QUERY_STORE ( CLEANUP_POLICY = ( STALE_QUERY_THRESHOLD_DAYS = <value> ) ) statement. |
max_plans_per_querymax_plans_per_query | bigintbigint | Limita il numero massimo di piani archiviati.Limits the maximum number of stored plans. Il valore predefinito è 200.Default value is 200. Se viene raggiunto il valore massimo, Query Store interrompe l'acquisizione dei nuovi piani per la query.If the maximum value is reached, Query Store stops capturing new plans for that query. Impostando su 0 viene rimossa la limitazione per quanto riguarda il numero di piani acquisiti.Setting to 0 removes the limitation with regards to the number of captured plans. Modificare utilizzando l' ALTER DATABASE<database> SET QUERY_STORE (MAX_PLANS_PER_QUERY = <n>) istruzione.Change by using the ALTER DATABASE<database> SET QUERY_STORE (MAX_PLANS_PER_QUERY = <n>) statement. |
query_capture_modequery_capture_mode | smallintsmallint | Modalità di acquisizione query attualmente attiva:The currently active query capture mode: 1 = tutte le query vengono acquisite.1 = ALL - all queries are captured. Si tratta del valore di configurazione predefinito per SQL ServerSQL Server ( SQL Server 2016 (13.x)SQL Server 2016 (13.x) e versioni successive).This is the default configuration value for SQL ServerSQL Server (SQL Server 2016 (13.x)SQL Server 2016 (13.x) and later). 2 = Acquisisci automaticamente le query pertinenti in base al numero di esecuzioni e al consumo di risorse.2 = AUTO - capture relevant queries based on execution count and resource consumption. Si tratta del valore di configurazione predefinito di Database SQLSQL Database.This is the default configuration value for Database SQLSQL Database. 3 = NONE: interrompe l'acquisizione di nuove query.3 = NONE - stop capturing new queries. Query Store continuerà a raccogliere le statistiche di compilazione e runtime per le query che sono già state acquisite.Query Store will continue to collect compile and runtime statistics for queries that were captured already. Usare questa configurazione con cautela poiché è possibile che l'acquisizione di query importanti non venga eseguita.Use this configuration cautiously since you may miss capturing important queries. 4 = personalizzato: consente di controllare ulteriormente i criteri di acquisizione delle query usando le opzioni QUERY_CAPTURE_POLICY.4 = CUSTOM - Allows additional control over the query capture policy using the QUERY_CAPTURE_POLICY options. Si applica a: SQL Server 2019 (15.x)SQL Server 2019 (15.x) e versioni successive.Applies to: SQL Server 2019 (15.x)SQL Server 2019 (15.x) and later. |
query_capture_mode_descquery_capture_mode_desc | nvarchar(60)nvarchar(60) | Descrizione testuale della modalità di acquisizione effettiva di Query Store:Textual description of the actual capture mode of Query Store: ALL (impostazione predefinita per SQL Server 2016 (13.x)SQL Server 2016 (13.x) )ALL (default for SQL Server 2016 (13.x)SQL Server 2016 (13.x)) Auto (impostazione predefinita per Database SQLSQL Database )AUTO (default for Database SQLSQL Database) NONENONE CUSTOMCUSTOM |
capture_policy_execution_countcapture_policy_execution_count | intint | Opzione criteri personalizzati modalità di acquisizione query.Query Capture Mode CUSTOM policy option. Definisce il numero di esecuzioni di una query nel periodo di valutazione.Defines the number of times a query is executed over the evaluation period. Il valore predefinito è 30.The default is 30. Si applica a: SQL Server 2019 (15.x)SQL Server 2019 (15.x) e versioni successive.Applies to: SQL Server 2019 (15.x)SQL Server 2019 (15.x) and later. |
capture_policy_total_compile_cpu_time_mscapture_policy_total_compile_cpu_time_ms | bigintbigint | Opzione criteri personalizzati modalità di acquisizione query.Query Capture Mode CUSTOM policy option. Definisce il tempo CPU di compilazione trascorso totale usato da una query nel periodo di valutazione.Defines total elapsed compile CPU time used by a query over the evaluation period. Il valore predefinito è 1000.The default is 1000. Si applica a: SQL Server 2019 (15.x)SQL Server 2019 (15.x) e versioni successive.Applies to: SQL Server 2019 (15.x)SQL Server 2019 (15.x) and later. |
capture_policy_total_execution_cpu_time_mscapture_policy_total_execution_cpu_time_ms | bigintbigint | Opzione criteri personalizzati modalità di acquisizione query.Query Capture Mode CUSTOM policy option. Definisce il tempo CPU di esecuzione trascorso totale usato da una query nel periodo di valutazione.Defines total elapsed execution CPU time used by a query over the evaluation period. Il valore predefinito è 100.The default is 100. Si applica a: SQL Server 2019 (15.x)SQL Server 2019 (15.x) e versioni successive.Applies to: SQL Server 2019 (15.x)SQL Server 2019 (15.x) and later. |
capture_policy_stale_threshold_hourscapture_policy_stale_threshold_hours | intint | Opzione criteri personalizzati modalità di acquisizione query.Query Capture Mode CUSTOM policy option. Definisce l'intervallo di valutazione per determinare se una query deve essere acquisita.Defines the evaluation interval period to determine if a query should be captured. Il valore predefinito è 24 ore.The default is 24 hours. Si applica a: SQL Server 2019 (15.x)SQL Server 2019 (15.x) e versioni successive.Applies to: SQL Server 2019 (15.x)SQL Server 2019 (15.x) and later. |
size_based_cleanup_modesize_based_cleanup_mode | smallintsmallint | Determina se la pulizia viene attivata automaticamente quando la quantità totale dei dati ha quasi raggiunto le dimensioni massime:Controls whether cleanup will be automatically activated when total amount of data gets close to maximum size: 0 = la pulizia non basata sulle dimensioni non verrà attivata automaticamente.0 = OFF - size-based cleanup won't be automatically activated. 1 = la pulizia basata sulle dimensioni automatiche verrà attivata automaticamente quando le dimensioni su disco raggiungono il 90% del max_storage_size_mb.1 = AUTO - size-based cleanup will be automatically activated when size on disk reaches 90 percent of max_storage_size_mb. Si tratta del valore di configurazione predefinito.This is the default configuration value. La pulizia basata sulle dimensioni rimuove per prime le query meno recenti e meno dispendiose.Size-based cleanup removes the least expensive and oldest queries first. Si interrompe quando viene raggiunto approssimativamente il 80% del max_storage_size_mb .It stops when approximately 80 percent of max_storage_size_mb is reached. |
size_based_cleanup_mode_descsize_based_cleanup_mode_desc | nvarchar(60)nvarchar(60) | Descrizione testuale della modalità di pulizia effettiva basata sulle dimensioni di Query Store:Textual description of the actual size-based cleanup mode of Query Store: OFFOFF Automatico (impostazione predefinita)AUTO (default) |
wait_stats_capture_modewait_stats_capture_mode | smallintsmallint | Controlla se Query Store esegue l'acquisizione delle statistiche di attesa:Controls whether Query Store performs capture of wait statistics: 0 = OFF0 = OFF 1 = on1 = ON Si applica a: SQL Server 2017 (14.x)SQL Server 2017 (14.x) e versioni successive.Applies to: SQL Server 2017 (14.x)SQL Server 2017 (14.x) and later. |
wait_stats_capture_mode_descwait_stats_capture_mode_desc | nvarchar(60)nvarchar(60) | Descrizione testuale della modalità di acquisizione delle statistiche di attesa effettiva:Textual description of the actual wait statistics capture mode: OFFOFF On (impostazione predefinita)ON (default) Si applica a: SQL Server 2017 (14.x)SQL Server 2017 (14.x) e versioni successive.Applies to: SQL Server 2017 (14.x)SQL Server 2017 (14.x) and later. |
actual_state_additional_infoactual_state_additional_info | nvarchar (8000)nvarchar(8000) | Attualmente non usato.Currently unused. Potrebbe essere implementato in futuro.May be implemented in the future. |
AutorizzazioniPermissions
È necessaria l'autorizzazione VIEW DATABASE STATE
.Requires the VIEW DATABASE STATE
permission.
Vedere ancheSee Also
sys.query_context_settings ()Transact-SQL sys.query_context_settings (Transact-SQL)
sys.query_store_plan ()Transact-SQL sys.query_store_plan (Transact-SQL)
sys.query_store_query ()Transact-SQL sys.query_store_query (Transact-SQL)
sys.query_store_query_text ()Transact-SQL sys.query_store_query_text (Transact-SQL)
sys.query_store_runtime_stats ()Transact-SQL sys.query_store_runtime_stats (Transact-SQL)
sys.query_store_wait_stats (Transact-SQL)sys.query_store_wait_stats (Transact-SQL)
sys.query_store_runtime_stats_interval ()Transact-SQL sys.query_store_runtime_stats_interval (Transact-SQL)
Monitoraggio delle prestazioni tramite Archivio query Monitoring Performance By Using the Query Store
Viste del catalogo (Transact-SQL) Catalog Views (Transact-SQL)
sys.fn_stmt_sql_handle_from_sql_stmt ()Transact-SQL sys.fn_stmt_sql_handle_from_sql_stmt (Transact-SQL)
Stored procedure di Query Store (Transact-SQL)Query Store Stored Procedures (Transact-SQL)