SQL Flow Field Guide

DBCC SHOWCONTIG

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

DBCC SHOWCONTIG: administrative check or maintenance

What changes

Input
database, table, index, cache or server state named in the command
Output or change
messages or result sets; maintenance forms change storage, caches or metadata

Syntax at a glance

DBCC SHOWCONTIG [ ( { table_name | table_id | view_name | view_id } [ , index_name | index_id ] ) ] [ WITH { [ , [ ALL_INDEXES ] ] [ , [ TABLERESULTS ] ] [ , [ FAST ] ] [ , [ ALL_LEVELS ] ] [ NO_INFOMSGS ] } ]

Work example

A legacy report still uses the deprecated DBCC SHOWCONTIG command.

Replace the report with sys.dm_db_index_physical_stats and select a scan mode that fits the workload.

Check your work The new report returns the needed index metrics with a documented scan cost.

Open Microsoft Learn for full syntax, permissions, and details for your version.