sys.dm_exec_trigger_stats (Transact-SQL)
Zwraca statystykę wydajności agregacji dla buforowanych wyzwalaczy.Widok zawiera jeden wiersz na wyzwalacz i okres istnienia wiersza trwa, dopóki procedura składowana pozostaje zbuforowana.Z chwilą usunięcia procedury składowanej z pamięci podręcznej odpowiedni wiersz zostaje usunięty z widoku.Jednocześnie zostaje wygenerowane zdarzenie śledzenia SQL Performance Statistics podobnie jak w przypadku funkcji sys.dm_exec_query_stats.
Nazwa kolumna |
Typ danych |
Description |
|---|---|---|
database_id |
int |
User-defined functions cannot contain an OUTPUT INTO clause that has a table as its target. |
object_id |
int |
Numer identyfikacyjny obiektu wyzwalacza. |
Typ |
char(2) |
BEGIN DIALOG CONVERSATION TA = wyzwalacza wirtualny plik dziennika (CLR) TR = SQL wyzwalacza |
END CONVERSATION |
nvarchar(60) |
GET CONVERSATION GROUP CLR_TRIGGER SQL_TRIGGER |
sql_handle |
varbinary(64) |
Ta opcja może służyć do skorelowania z kwerendy sys.dm_exec_query_stats które zostały wykonane od w ramach tego wyzwalacza. |
plan_handle |
varbinary(64) |
User-defined functions can be nested; that is, one user-defined function can call another.The nesting level is incremented when the called function starts execution, and decremented when the called function finishes execution.Wartość ta może być używany z sys.dm_exec_cached_plans dynamiczny widok zarządzania. |
Exceeding the maximum levels of nesting causes the whole calling function chain to fail. |
datetime |
Data i godzina dodania wyzwalacza do pamięci podręcznej. |
Methods invoked from within managed code do not count against this limit. |
datetime |
Using Sort Order in CLR Table-valued Functions |
When using the ORDER clause in CLR table-valued functions, follow these guidelines: |
bigint |
You must ensure that results are always ordered in the specified order. |
total_worker_time |
bigint |
If an ORDER clause is specified, the output of the table-valued function must be sorted according to the collation of the column (explicit or implicit). |
For example, if the column collation is Chinese (either specified in the DDL for the table-valued function or obtained from the database collation), the returned results must be sorted according to Chinese sorting rules. |
bigint |
Czas procesora CPU (w mikrosekundach) zużyty na ostatnie wykonanie wyzwalacza. |
Only use the ORDER clause if you know it is useful to the query processor. |
bigint |
Maksymalny czas procesora CPU (w mikrosekundach) zużyty kiedykolwiek na jedno wykonanie wyzwalacza. |
Insert queries where the ORDER clause is compatible with an index. |
bigint |
Maksymalny czas procesora CPU (w mikrosekundach) zużyty kiedykolwiek na jedno wykonanie wyzwalacza. |
ORDER BY clauses that are compatible with the ORDER clause. |
bigint |
Aggregates, where GROUP BY is compatible with ORDER clause. |
DISTINCT aggregates where the distinct columns are compatible with the ORDER clause. |
bigint |
The ORDER clause does not guarantee ordered results when a SELECT query is executed, unless ORDER BY is also specified in the query. |
min_physical_reads |
bigint |
The following table lists the system catalog views that you can use to return metadata about user-defined functions. |
System View |
bigint |
sys.sql_modules |
total_logical_writes |
bigint |
The definition of functions created by using the ENCRYPTION option cannot be viewed by using sys.sql_modules; however, other information about the encrypted functions is displayed. |
sys.assembly_modules |
bigint |
Displays information about CLR user-defined functions. |
sys.parameters |
bigint |
Displays information about the parameters defined in user-defined functions. |
sys.sql_expression_dependencies |
bigint |
Displays the underlying objects referenced by a function. |
Requires CREATE FUNCTION permission in the database and ALTER permission on the schema in which the function is being created. |
bigint |
If the function specifies a user-defined type, requires EXECUTE permission on the type. |
Using a scalar-valued user-defined function that calculates the ISO week |
bigint |
Liczba odczytów logicznych podczas ostatniego wykonywania wyzwalacza. |
This function takes a date argument and calculates the ISO week number. |
bigint |
Minimalna liczba odczytów logicznych dokonanych kiedykolwiek przez wyzwalacz podczas jednego wykonywania. |
max_logical_reads |
bigint |
Maksymalna liczba odczytów logicznych dokonanych kiedykolwiek przez wyzwalacz podczas jednego wykonywania. |
total_elapsed_time |
bigint |
Łączny czas (w mikrosekundach) ukończonych wykonań wyzwalacza. |
Here is the function call. |
bigint |
Łączny czas (w mikrosekundach) ostatniego ukończonego wykonania wyzwalacza. |
ISO Week |
bigint |
Creating an inline table-valued function |
The following example returns an inline table-valued function. |
bigint |
Maksymalny czas wykonywania wyzwalacza (w mikrosekundach) spośród ukończonych wykonań. |
Uprawnienia
Wymaga uprawnienia VIEW SERVER STATE na serwerze.
Remarks
To invoke the function, run this query.
Przykłady
Creating a multi-statement table-valued function
SELECT TOP 10 d.object_id, d.database_id, db_name(database_id) 'db name', object_name (object_id, database_id) 'proc name', d.cached_time, d.last_execution_time, d.total_elapsed_time, d.total_elapsed_time/d.execution_count AS [avg_elapsed_time], d.last_elapsed_time, d.execution_count
from sys.dm_exec_trigger_stats d
ORDER BY [total_worker_time] DESC;
GO
Historia zmian
Microsoft Learning |
|---|
Wymieniony przykład ze zaktualizowanym kodem. |
See Also