Commit 13399e3d by Dave Wentzel

wip hekaton monitoring

parent 83507252
--this is not yet integrated into PerformanceCollector
--this ideally should be run in any database with hekaton enabled
--overall memory usage by table
INSERT INTO PerformanceCollector.PerformanceCollector.xtp_table_memory_stats
SELECT object_name(object_id) AS table_name,
memory_allocated_for_table_kb/1024 memory_allocated_for_table_mb,
memory_used_by_table_kb/1024 memory_used_by_table_mb,
memory_allocated_for_indexes_kb/1024 memory_allocated_for_indexes_mb,
memory_used_by_indexes_kb/1024 memory_used_by_indexes_mb
FROM sys.dm_db_xtp_table_memory_stats
--total xtp memory
INSERT INTO PerformanceCollector.PerformanceCollector.xtpmem
SELECT type clerck_type
, name
, memory_node_id
, pages_kb/1024 pages_mb
FROM sys.dm_os_memory_clerks
WHERE type LIKE '%xtp%'
--hash bucket metrics
INSERT INTO PerformanceCollector.PerformanceCollector.xtp_buckets
SELECT Object_name(his.object_id) AS table_name,
si.NAME AS index_name,
his.empty_bucket_count,
his.total_bucket_count
FROM sys.dm_db_xtp_hash_index_stats his
INNER JOIN sys.indexes si
ON his.object_id = si.object_id
AND his.index_id = si.index_id
\ No newline at end of file
USE PerformanceCollector
GO
if not exists (select * from sys.objects where object_id = object_id('PerformanceCollector.xtp_table_memory_stats'))
BEGIN
CREATE TABLE PerformanceCollector.xtp_table_memory_stats(
[table_name] [nvarchar](128) NULL,
[memory_allocated_for_table_mb] [bigint] NULL,
[memory_used_by_table_mb] [bigint] NULL,
[memory_allocated_for_indexes_mb] [bigint] NULL,
[memory_used_by_indexes_mb] [bigint] NULL
) ON [PRIMARY]
END
GO
if not exists (select * from sys.objects where object_id = object_id('PerformanceCollector.xtpmem'))
BEGIN
CREATE TABLE PerformanceCollector.xtpmem(
[clerck_type] [nvarchar](60) NOT NULL,
[name] [nvarchar](256) NOT NULL,
[memory_node_id] [smallint] NOT NULL,
[pages_mb] [bigint] NULL
) ON [PRIMARY]
END
GO
if not exists (select * from sys.objects where object_id = object_id('PerformanceCollector.xtp_buckets'))
BEGIN
CREATE TABLE PerformanceCollector.xtp_buckets(
[table_name] [nvarchar](128) NULL,
[index_name] [sysname] NULL,
[empty_bucket_count] [bigint] NULL,
[total_bucket_count] [bigint] NOT NULL
) ON [PRIMARY]
END
GO
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment