sys.dm_db_xtp_object_stats (Transact-SQL)sys.dm_db_xtp_object_stats (Transact-SQL)

适用于: 是SQL Server是Azure SQL 数据库否Azure SQL 数据仓库否并行数据仓库APPLIES TO: yesSQL Server yesAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

报告自上次数据库重新启动以来对每个 内存中 OLTPIn-Memory OLTP 对象进行的操作所影响的行数。Reports the number rows affected by operations on each of the 内存中 OLTPIn-Memory OLTP objects since the last database restart. 统计信息会在操作执行时更新(无论事务提交还是回滚)。Statistics are updated when the operation executes, regardless of whether the transaction commits or was rolled back.

sys.dm_db_xtp_object_stats 可以帮助您标识更改最多的内存优化表。sys.dm_db_xtp_object_stats can help you identify which memory-optimized tables are changing the most. 您可以决定删除表中未使用或很少使用的索引,因为每个索引都会影响性能。You may decide to remove unused or rarely used indexes on the table, as each index affects performance. 如果存在哈希索引,则您应定期重新计算桶计数。If there are hash indexes, you should periodically re-evaluate the bucket-count. 有关详细信息,请参阅 哈希索引确定正确的存储桶计数For more information, see Determining the Correct Bucket Count for Hash Indexes.

sys.dm_db_xtp_object_stats 可以帮助您标识引发写/写冲突(这可能会影响应用程序性能)的内存优化表。sys.dm_db_xtp_object_stats can help you identify which memory-optimized tables incur write-write conflicts, which can affect the performance of your application. 例如,如果您有事务重试逻辑,则相同语句可能需要执行多次。For example, if you have transaction retry logic, the same statement may need to be executed more than once. 您还可以使用此信息标识需要写/写错误处理的表(以及因此得到的业务逻辑)。Also, you can use this information to identify the tables (and therefore business logic) that require write-write error handling.

该视图为数据库中的每个内存优化表包含一行。The view contains a row for each memory optimized table in the database.

有关详细信息,请参阅内存中 OLTP(内存中优化)For more information, see In-Memory OLTP (In-Memory Optimization).

列名Column name 数据类型Data type 描述Description
object_idobject_id bigintbigint 对象的 ID。The ID of the object.
row_insert_attemptsrow_insert_attempts bigintbigint 自上次数据库重新启动以来由已提交和中止的事务插入表中的行数。The number of rows inserted into the table since the last database restart by both committed and aborted transactions.
row_update_attemptsrow_update_attempts bigintbigint 自上次数据库重新启动以来由已提交和中止的事务在表中更新的行数。The number of rows updated in the table since the last database restart by both committed and aborted transactions.
row_delete_attemptsrow_delete_attempts bigintbigint 自上次数据库重新启动以来由已提交和中止的事务从表中删除的行数。The number of rows deleted from the table since the last database restart by both committed and aborted transactions.
write_conflictswrite_conflicts bigintbigint 自上次数据库重新启动以来发生的写入冲突数。The number of write conflicts that occurred since the last database restart.
unique_constraint_violationsunique_constraint_violations bigintbigint 自上次数据库重新启动以来发生的唯一约束冲突数。The number of unique constraint violations that have occurred since the last database restart.
object_addressobject_address varbinary(8)varbinary(8) 仅限内部使用。Internal use only.

权限Permissions

要求对当前数据库拥有 VIEW DATABASE STATE 权限。Requires VIEW DATABASE STATE permission on the current database.

请参阅See Also

内存优化表动态管理视图(Transact SQL)Memory-Optimized Table Dynamic Management Views (Transact-SQL)