Fixing Heap fragmentation in Azure Synapse Analytics tables

Copper Contributor

I can't find any info about fragmentation in heap tables.


I am looking for the equivalent of this ( for SQL Server 2022.


select *
From sys.dm_db_index_physical_stats(db_id('DWH'),object_id('schema.table_name'),null,null,'detailed')


Running the above command returns the error "Msg 103010, Level 16, State 1, Line 43
Parse error at line: 2, column: 37: Incorrect syntax near 'db_id'."


When I run the command "ALTER TABLE schema.table_name REBUILD" it runs successfully. What does this command do on a HEAP table in Azure Synapse Analytics? How can I check the fragmentation?

0 Replies