How to get space used by In-Memory table in SqlServer












2















I'm trying to understand how much storage In-Memory table consumes in SqlServer:



SELECT is_memory_optimized,durability_desc FROM sys.tables WHERE name='TBL_HSD_AD_OR'
select count(*) [#Rows] from TBL_HSD_AD_OR with(nolock)


enter image description here



Now when I'm using EXEC sp_spaceused I get:



EXEC sp_spaceused 'TBL_HSD_AD_OR'


enter image description here



Is there a different way to get the space used for Memory-Optimized tables?










share|improve this question
















bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






migrated from stackoverflow.com Sep 19 '16 at 9:37


This question came from our site for professional and enthusiast programmers.











  • 1





    sys.dm_db_xtp_table_memory_stats?

    – Damien_The_Unbeliever
    Sep 13 '16 at 7:41






  • 1





    Disregard if you have already seen this information, but I found it interesting - -mssqltips.com/sqlservertip/3339/…

    – Scott Hodgin
    Sep 19 '16 at 18:23











  • Space used where? In memory? On disc for durability?

    – Martin Smith
    Sep 19 '16 at 21:16











  • Total disk storage per each table

    – Yosi Dahari
    Sep 20 '16 at 14:25
















2















I'm trying to understand how much storage In-Memory table consumes in SqlServer:



SELECT is_memory_optimized,durability_desc FROM sys.tables WHERE name='TBL_HSD_AD_OR'
select count(*) [#Rows] from TBL_HSD_AD_OR with(nolock)


enter image description here



Now when I'm using EXEC sp_spaceused I get:



EXEC sp_spaceused 'TBL_HSD_AD_OR'


enter image description here



Is there a different way to get the space used for Memory-Optimized tables?










share|improve this question
















bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






migrated from stackoverflow.com Sep 19 '16 at 9:37


This question came from our site for professional and enthusiast programmers.











  • 1





    sys.dm_db_xtp_table_memory_stats?

    – Damien_The_Unbeliever
    Sep 13 '16 at 7:41






  • 1





    Disregard if you have already seen this information, but I found it interesting - -mssqltips.com/sqlservertip/3339/…

    – Scott Hodgin
    Sep 19 '16 at 18:23











  • Space used where? In memory? On disc for durability?

    – Martin Smith
    Sep 19 '16 at 21:16











  • Total disk storage per each table

    – Yosi Dahari
    Sep 20 '16 at 14:25














2












2








2








I'm trying to understand how much storage In-Memory table consumes in SqlServer:



SELECT is_memory_optimized,durability_desc FROM sys.tables WHERE name='TBL_HSD_AD_OR'
select count(*) [#Rows] from TBL_HSD_AD_OR with(nolock)


enter image description here



Now when I'm using EXEC sp_spaceused I get:



EXEC sp_spaceused 'TBL_HSD_AD_OR'


enter image description here



Is there a different way to get the space used for Memory-Optimized tables?










share|improve this question
















I'm trying to understand how much storage In-Memory table consumes in SqlServer:



SELECT is_memory_optimized,durability_desc FROM sys.tables WHERE name='TBL_HSD_AD_OR'
select count(*) [#Rows] from TBL_HSD_AD_OR with(nolock)


enter image description here



Now when I'm using EXEC sp_spaceused I get:



EXEC sp_spaceused 'TBL_HSD_AD_OR'


enter image description here



Is there a different way to get the space used for Memory-Optimized tables?







sql-server sql-server-2014 storage memory-optimized-tables






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 19 '16 at 18:07







Yosi Dahari

















asked Sep 13 '16 at 6:18









Yosi DahariYosi Dahari

287213




287213





bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






migrated from stackoverflow.com Sep 19 '16 at 9:37


This question came from our site for professional and enthusiast programmers.






migrated from stackoverflow.com Sep 19 '16 at 9:37


This question came from our site for professional and enthusiast programmers.










  • 1





    sys.dm_db_xtp_table_memory_stats?

    – Damien_The_Unbeliever
    Sep 13 '16 at 7:41






  • 1





    Disregard if you have already seen this information, but I found it interesting - -mssqltips.com/sqlservertip/3339/…

    – Scott Hodgin
    Sep 19 '16 at 18:23











  • Space used where? In memory? On disc for durability?

    – Martin Smith
    Sep 19 '16 at 21:16











  • Total disk storage per each table

    – Yosi Dahari
    Sep 20 '16 at 14:25














  • 1





    sys.dm_db_xtp_table_memory_stats?

    – Damien_The_Unbeliever
    Sep 13 '16 at 7:41






  • 1





    Disregard if you have already seen this information, but I found it interesting - -mssqltips.com/sqlservertip/3339/…

    – Scott Hodgin
    Sep 19 '16 at 18:23











  • Space used where? In memory? On disc for durability?

    – Martin Smith
    Sep 19 '16 at 21:16











  • Total disk storage per each table

    – Yosi Dahari
    Sep 20 '16 at 14:25








1




1





sys.dm_db_xtp_table_memory_stats?

– Damien_The_Unbeliever
Sep 13 '16 at 7:41





sys.dm_db_xtp_table_memory_stats?

– Damien_The_Unbeliever
Sep 13 '16 at 7:41




1




1





Disregard if you have already seen this information, but I found it interesting - -mssqltips.com/sqlservertip/3339/…

– Scott Hodgin
Sep 19 '16 at 18:23





Disregard if you have already seen this information, but I found it interesting - -mssqltips.com/sqlservertip/3339/…

– Scott Hodgin
Sep 19 '16 at 18:23













Space used where? In memory? On disc for durability?

– Martin Smith
Sep 19 '16 at 21:16





Space used where? In memory? On disc for durability?

– Martin Smith
Sep 19 '16 at 21:16













Total disk storage per each table

– Yosi Dahari
Sep 20 '16 at 14:25





Total disk storage per each table

– Yosi Dahari
Sep 20 '16 at 14:25










1 Answer
1






active

oldest

votes


















0














I guess this helps you..



With the help of 'Cached Page count' we can calculate the Total space occupied.



        set nocount on;
set transaction isolation level read uncommitted;
select
count(*)as cached_pages_count,
(COUNT(*) * 8.0) / 1024 AS Total_MB_Occupied, -- convert pages into MB - the page size is 8 KB for sql server
obj.name as objectname,
ind.name as indexname,
obj.index_id as indexid
from sys.dm_os_buffer_descriptors as bd
inner join
(
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.hobt_id
and (au.type = 1 or au.type = 3)
union all
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.partition_id
and au.type = 2
) as obj
on bd.allocation_unit_id = obj.allocation_unit_id
left outer join sys.indexes ind
on obj.objectid = ind.object_id
and obj.index_id = ind.index_id
where bd.database_id = db_id()
and bd.page_type in ('data_page', 'index_page')
and obj.name like '%TABEL NAME%' --- **Provide your table name**
group by obj.name, ind.name, obj.index_id
order by cached_pages_count desc





share|improve this answer



















  • 1





    Not official. Not explained. Doesn't work.

    – Yosi Dahari
    Sep 13 '16 at 17:19











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f150024%2fhow-to-get-space-used-by-in-memory-table-in-sqlserver%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I guess this helps you..



With the help of 'Cached Page count' we can calculate the Total space occupied.



        set nocount on;
set transaction isolation level read uncommitted;
select
count(*)as cached_pages_count,
(COUNT(*) * 8.0) / 1024 AS Total_MB_Occupied, -- convert pages into MB - the page size is 8 KB for sql server
obj.name as objectname,
ind.name as indexname,
obj.index_id as indexid
from sys.dm_os_buffer_descriptors as bd
inner join
(
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.hobt_id
and (au.type = 1 or au.type = 3)
union all
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.partition_id
and au.type = 2
) as obj
on bd.allocation_unit_id = obj.allocation_unit_id
left outer join sys.indexes ind
on obj.objectid = ind.object_id
and obj.index_id = ind.index_id
where bd.database_id = db_id()
and bd.page_type in ('data_page', 'index_page')
and obj.name like '%TABEL NAME%' --- **Provide your table name**
group by obj.name, ind.name, obj.index_id
order by cached_pages_count desc





share|improve this answer



















  • 1





    Not official. Not explained. Doesn't work.

    – Yosi Dahari
    Sep 13 '16 at 17:19
















0














I guess this helps you..



With the help of 'Cached Page count' we can calculate the Total space occupied.



        set nocount on;
set transaction isolation level read uncommitted;
select
count(*)as cached_pages_count,
(COUNT(*) * 8.0) / 1024 AS Total_MB_Occupied, -- convert pages into MB - the page size is 8 KB for sql server
obj.name as objectname,
ind.name as indexname,
obj.index_id as indexid
from sys.dm_os_buffer_descriptors as bd
inner join
(
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.hobt_id
and (au.type = 1 or au.type = 3)
union all
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.partition_id
and au.type = 2
) as obj
on bd.allocation_unit_id = obj.allocation_unit_id
left outer join sys.indexes ind
on obj.objectid = ind.object_id
and obj.index_id = ind.index_id
where bd.database_id = db_id()
and bd.page_type in ('data_page', 'index_page')
and obj.name like '%TABEL NAME%' --- **Provide your table name**
group by obj.name, ind.name, obj.index_id
order by cached_pages_count desc





share|improve this answer



















  • 1





    Not official. Not explained. Doesn't work.

    – Yosi Dahari
    Sep 13 '16 at 17:19














0












0








0







I guess this helps you..



With the help of 'Cached Page count' we can calculate the Total space occupied.



        set nocount on;
set transaction isolation level read uncommitted;
select
count(*)as cached_pages_count,
(COUNT(*) * 8.0) / 1024 AS Total_MB_Occupied, -- convert pages into MB - the page size is 8 KB for sql server
obj.name as objectname,
ind.name as indexname,
obj.index_id as indexid
from sys.dm_os_buffer_descriptors as bd
inner join
(
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.hobt_id
and (au.type = 1 or au.type = 3)
union all
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.partition_id
and au.type = 2
) as obj
on bd.allocation_unit_id = obj.allocation_unit_id
left outer join sys.indexes ind
on obj.objectid = ind.object_id
and obj.index_id = ind.index_id
where bd.database_id = db_id()
and bd.page_type in ('data_page', 'index_page')
and obj.name like '%TABEL NAME%' --- **Provide your table name**
group by obj.name, ind.name, obj.index_id
order by cached_pages_count desc





share|improve this answer













I guess this helps you..



With the help of 'Cached Page count' we can calculate the Total space occupied.



        set nocount on;
set transaction isolation level read uncommitted;
select
count(*)as cached_pages_count,
(COUNT(*) * 8.0) / 1024 AS Total_MB_Occupied, -- convert pages into MB - the page size is 8 KB for sql server
obj.name as objectname,
ind.name as indexname,
obj.index_id as indexid
from sys.dm_os_buffer_descriptors as bd
inner join
(
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.hobt_id
and (au.type = 1 or au.type = 3)
union all
select object_id as objectid,
object_name(object_id) as name,
index_id,allocation_unit_id
from sys.allocation_units as au
inner join sys.partitions as p
on au.container_id = p.partition_id
and au.type = 2
) as obj
on bd.allocation_unit_id = obj.allocation_unit_id
left outer join sys.indexes ind
on obj.objectid = ind.object_id
and obj.index_id = ind.index_id
where bd.database_id = db_id()
and bd.page_type in ('data_page', 'index_page')
and obj.name like '%TABEL NAME%' --- **Provide your table name**
group by obj.name, ind.name, obj.index_id
order by cached_pages_count desc






share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 13 '16 at 6:47







K.K















  • 1





    Not official. Not explained. Doesn't work.

    – Yosi Dahari
    Sep 13 '16 at 17:19














  • 1





    Not official. Not explained. Doesn't work.

    – Yosi Dahari
    Sep 13 '16 at 17:19








1




1





Not official. Not explained. Doesn't work.

– Yosi Dahari
Sep 13 '16 at 17:19





Not official. Not explained. Doesn't work.

– Yosi Dahari
Sep 13 '16 at 17:19


















draft saved

draft discarded




















































Thanks for contributing an answer to Database Administrators Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f150024%2fhow-to-get-space-used-by-in-memory-table-in-sqlserver%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Liste der Baudenkmale in Friedland (Mecklenburg)

Single-Malt-Whisky

Czorneboh