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

X++ Show Cross-Reference With Read/Write field reference

New release of TRUDUtilsD365 Developer Add-in that includes an advanced Cross-references form, allowing you to see the actual X++ code and det...

14 days ago

Support Parallel Processing for Archive Jobs in Dynamics 365 Finance and Operations

We’re pleased to introduce a new capability for Dynamics 365 Finance and Operations archive with Dataverse long-term retention: parallel proce...

22 days ago

D365FO License usage log utility

Learn how the new D365FO licensing model works and discover an open-source X++ utility to monitor actual user activity and optimize your licen...

1 month ago

Implement Service-based integration in D365FO

This blog post describes how to implement a synchronous integration with D365FO by creating a service using the External Integration framework...

1 month ago

Sync data from Dynamics 365 Finance & Operations Azure SQL Database (Tier2) to local SQL Server (AxDB)

A new utility to synchronize data from D365FO cloud environments to local AxDB, featuring incremental sync and smart strategies.

2 months ago

Action ‘Update_a_record’ failed: An error has occurred. No resources were found when selecting for update – Fixing Cross-Company Update Issues in Finance & Operations Using Dataverse Virtual Entities (Power Automate)

Recently, while trying to update the Projects table in Finance & Operations using the Fin & Ops Apps actions in Power Automate, we ran...

4 months ago

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

Microsoft is updating the timeline for in-app notifications and per-user license validation to give customers more time to prepare. To enable ...

6 months ago

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

In-product notifications and user subscription license (USL) validation has been amended for customers in FY25 Q4, FY26 Q1 renewals. Microsoft...

6 months ago

D365FO Integration: Import Purchase Orders from PDF using Gemini AI

Learn how to use AI to import purchase orders into Dynamics 365 Finance from complex PDF files. This post covers integration design, sample pr...

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