# Data Warehouse index fragementation

**URL:** <https://community.squaredup.com/t/data-warehouse-index-fragementation/901>\
**Category:** Dashboard Server\
**Tags:** scom\
**Created:** [January 22, 2019, 12:52pm UTC](https://community.squaredup.com/t/data-warehouse-index-fragementation/901 "2019-01-22T12:52:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtbywalski](https://community.squaredup.com/letter_avatar_proxy/v4/letter/r/b487fb/32.png) [@rtbywalski](https://community.squaredup.com/u/rtbywalski)\
**Post date:** [January 22, 2019, 12:52pm UTC](https://community.squaredup.com/t/data-warehouse-index-fragementation/901/1 "2019-01-22T12:52:47Z")

</div>

I was reading Kevin Holman’s script library on his blog page today and came across this query and was wondering if anyone had tried this yet. He gave the following SQL query to check and see how badly your Data Warehouse Database index is fragmented

&nbsp;

–Show index fragmentation (to determine how badly you need a reindex – logical scan frag \> 10% = bad. Scan density below 80 = bad): DBCC SHOWCONTIG DBCC SHOWCONTIG WITH FAST –(less data than above – in case you don’t have time)

&nbsp;

I was thinking could we set up a rule to run this periodically and if it encounters an error run the following script he gave as a recovery?

&nbsp;

–Reindex the database: USE OperationsManager go SET ANSI\_NULLS ON SET ANSI\_PADDING ON SET ANSI\_WARNINGS ON SET ARITHABORT ON SET CONCAT\_NULL\_YIELDS\_NULL ON SET QUOTED\_IDENTIFIER ON SET NUMERIC\_ROUNDABORT OFF EXEC SP\_MSForEachTable “Print ‘Reindexing ‘+’?’ DBCC DBREINDEX (’?’)” –Table by table: DBCC DBREINDEX (‘TableName’)

&nbsp;

Was just thinking it could help make SCOM self healing and keep performance at its max.

---

<div class="post-metadata">

**Author:** ![Jelly](https://community.squaredup.com/user_avatar/community.squaredup.com/jelly/32/812_2.png) [@Jelly](https://community.squaredup.com/u/Jelly)\
**Post date:** [January 22, 2019, 1:08pm UTC](https://community.squaredup.com/t/data-warehouse-index-fragementation/901/2 "2019-01-22T13:08:05Z")

</div>

We run the ReIndex once a day to ensure the Console is responsive. I can’t recommend enough!

Just make sure it’s done outside of normal maintenance:

[https://kevinholman.com/2017/08/03/what-sql-maintenance-should-i-perform-on-my-scom-2016-databases/](https://kevinholman.com/2017/08/03/what-sql-maintenance-should-i-perform-on-my-scom-2016-databases/)

Don’t force SQL to do too much at once or you’ll have bigger problems!

Also, the check is good, but it will return _a lot_ of information that you’ll need to comb through. Do it once to get a baseline, then re-index and compare.

---

<div class="post-metadata">

**Author:** ![rtbywalski](https://community.squaredup.com/letter_avatar_proxy/v4/letter/r/b487fb/32.png) [@rtbywalski](https://community.squaredup.com/u/rtbywalski)\
**Post date:** [January 22, 2019, 1:17pm UTC](https://community.squaredup.com/t/data-warehouse-index-fragementation/901/3 "2019-01-22T13:17:04Z")

</div>

Had that article book marked already to work with my SQL team to make sure all the recommendations in it are followed when we stand up our 2016 environment.

---

<div class="post-metadata">

**Author:** ![Jelly](https://community.squaredup.com/user_avatar/community.squaredup.com/jelly/32/812_2.png) [@Jelly](https://community.squaredup.com/u/Jelly)\
**Post date:** [January 22, 2019, 1:21pm UTC](https://community.squaredup.com/t/data-warehouse-index-fragementation/901/4 "2019-01-22T13:21:38Z")

</div>

Great to hear! (Ignore my last - It’s one of those days!)
