Commit 13399e3d authored by Dave Wentzel's avatar Dave Wentzel
Browse files

wip hekaton monitoring

parent 83507252
Loading
Loading
Loading
Loading

hekaton.sql

0 → 100644
+33 −0
Original line number Diff line number Diff line
--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

hekaton_objects.sql

0 → 100644
+41 −0
Original line number Diff line number Diff line
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