Loading...

How to get Dynamics 365 Finance and Operations table sizes

How to get Dynamics 365 Finance and Operations table sizes
How to get Dynamics 365 Finance and Operations table sizes Maris Orbidans Thu, 07/27/2023 - 18:45
Body

How to get Dynamics 365 Finance and Operations table sizes ? How big is my table in  F&O DB?

Rather easy question to answer in good old Ax - from MS SQL Server Management Studio > right click on DB > Reports > Standard Reports > Disk Usage by Top Tables.

How to get Dynamics 365 Finance and Operations table sizes

But not so fast in Dynamics 365 F&O!

MS nicely allow access to a Tier-2 DB in non-productive environments (request access in LCS) and we can work with it using the MS SQL Server Management Studio. However, DB now is Azure SQL DB and it does not allow MSSMS reports.

You can retrieve information about table row count and size with such query:

select S.name+ '.'+ T.name as [table]
, (select SUM(rows) from sys.partitions where object_id = tmp.object_id and index_id in (1, 0) ) AS [rows]
, data_MB, index_MB, allocated_MB, unused_MB
from (select part.object_id
		,cast(sum(alloc.data_pages* 8)/ 1024.00 as numeric(16, 2)) as data_MB
		,cast(sum((alloc.used_pages- alloc.data_pages)* 8)/ 1024.00 as numeric(16, 2)) as index_MB
		,cast(sum(alloc.total_pages* 8)/ 1024.00 as numeric(16, 2)) as allocated_MB
		,cast(sum((alloc.total_pages - alloc.used_pages)* 8)/ 1024.00 as numeric(16, 2)) as unused_MB
	from sys.partitions part
	join sys.allocation_units alloc on part.partition_id = alloc.container_id
	group by part.object_id) as tmp
join sys.tables T on T.object_id = tmp.object_id
join sys.schemas AS S on S.schema_id = T.schema_id
where T.type = 'U'  --not counting system tables
--and T.name like '%ledger%' --table name filter
--and S.name <> 'dbo' --checking for non DBO schema
order by allocated_MB desc

Note table name filter in "where" conditions.

Another note. That this unfortunately does not work for Dataverse DB connections (TDS feature) - it simply does not expose required system tables.

 

How to get Dynamics 365 Finance and Operations table sizes

Published on:

Learn more
Featured Articles | Dynamics Chronicles
Featured Articles | Dynamics Chronicles

Welcome to our blog, the content is entirely dedicated to Microsoft Dynamics 365, CRM, Power Platform, Common Data Service (CDS) but also Azure. Follow us !

Share post:

Related posts

New Feature in Dynamics 365 F&O 10.0.45 Preview: Customer Invoice Logging and Traceability Framework

Have you been posting Sales Order Invoices and Customer Free Text Invoices through batch jobs, only to struggle with tracking the status of th...

4 days ago

Part-10: Create your Custom Agent for D365 F&O[Chart of Account Agent]

Enough talk. Let’s see Copilot Studio in action. Over the weekend, I built something powerful – a custom AI agent for Microsoft Dynamics 365 F...

10 days ago

New Approved Customer List mapping for Items in Dynamics 365 Finance and operations

Take control of your sales process with the latest feature in Microsoft Dynamics 365 Finance – the Approved Customer List! This powerful new f...

25 days ago

Part-9: Connect and Query Dynamics 365 Finance and operations data with Copilot studio

In this video, we kick off an exciting new series focused on extending Copilot Studio capabilities by connecting it to real enterprise data! �...

25 days ago

How to Create Deep Links to D365 F&O Records with Dataverse Virtual Tables

It is a common requirement for SaaS platform that exposes form over data to be able to share a secure link (a.k.a. Deep Link) to access a give...

3 months ago

Simplifying License Management for Dynamics 365 Finance and Operations: Improved User License Validation

Starting April 30th, Dynamics 365 administrators will gain access to new license usage reporting tools, centralizing user license management. ...

4 months ago

D365FO Integration: Import Sales Orders from an External Web Application

Learn how to implement robust and efficient process to import complex documents into Dynamics 365 Finance and Operations from external Web ser...

4 months ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy