Saturday, June 13, 2009

DBCC SHRINKDATABASE Will it cause Index Fragmentation Series 4 (Explanation)

Well as I learnt in previous blog Shrink Database caused fragmentation, but why? Before we discuss fragmentation, let me try to explain DBCC ShrinkDatabase command.

DBCC ShrinkDatabase command takes database name, Target Percent and Truncate | NoTruncate as parameters.

Truncate or NoTruncate indicate to database engine if space reclaimed by database engine be given back to Operating System or not.

Truncate: SQL Database engine releases space to OS, NOTruncate: Does not release space to OS though file content is  (leaving empty space at the end).

Target Percent is slightly confused here. Target Percent is not Target Size that database should be post shrinking operation but Target Percent is Target free space database should have post shrinking.

When database is shrunk either by Management Studio or DBCC command it moves data from end of file to beginning or starting of file. It tries to fill pages as it gets to move from end to start of file. So pages can not be moved in chunks (as there may not be huge chunks of pages at start in a normal production environment) but pages maybe moved individually inducing fragmentation.

In this case I have learnt that a completely defragmented index is fragmented to 97% post shrink operation and that is terrifying with regards to performance. Are you all seeing the same :)

Thus if one if forced to do a shrink operation it should be followed by a rebuilding Index (DBCC DBREINDEX) to defragment index.

Also this is one of reasons for Auto Shrink Database Property to be turned off.

Now in a later post I would like to check if Compressing and Decompressing an existing table will induce fragmentation or not or maybe something more interesting :)

If you have any questions / comments / corrections pertaining to any of fragmentation details please feel free to send mail to me at


Anonymous said...

Inhibit Our Risqu‚ Prices at, The Hose [b][url=]Online Pharmaceutical chemist's [/url][/b] To [url=]Buy Viagra[/url] Online ! You Can also Unearth Countless Deals When You [url=]Buy Cialis[/url] and When You You [url=]Buy Levitra[/url] Online. We Also Careen a Aristocrats crust Generic [url=]Phentermine[/url] In holdings of Your Comestibles ! We Purloin up M‚row attend to [url=]Viagra[/url] and Also [url=]Generic Viagra[/url] !

Anonymous said...

Make the animalistic with two backs casinos? separate this advanced [url=]casino[/url] superintend and uphold a combat up online casino games like slots, blackjack, roulette, baccarat and more at .
you can also dilly-dallying our good palate [url=]casino[/url] evade at and be winning in open compressed create of !
another girder [url=]casino spiele[/url] idea is , in compensation german gamblers, collect well-wishing online casino bonus.

Anonymous said...

I read this forum since 2 weeks and now i have decided to register to share with you my ideas. [url=]:)[/url]

Anonymous said...

Making money on the internet is easy in the underground world of [URL=]blackhat code[/URL], It's not a big surprise if you haven’t heard of it before. Blackhat marketing uses not-so-popular or little-understood methods to generate an income online.

Anonymous said...

las vegas pharmacy jobs define pharmacy [url=]epivir[/url]
marie gardner pharmacy faculty pharmacy belize [url=]canadian pharmacy school[/url]
university of tennessee college of pharmacy ranch pharmacy scottsdale [url=]epivir[/url]
discount levitra pharmacy purchase unc pharmacy [url=]ethics in pharmacy[/url]

Anonymous said...

california highway travel value travel destinations [url=]flight trousers[/url]
monogram travel suticase travel between victoria station and cambridge [url=]essential travel guide[/url]
erxperiments of orbital travel amd time wisconsin travel distance [url=]rental car france[/url]
have camera will travel tv show 1956 bangkok travel agent flights flight london cheap [url=]philippine travel tour exposition[/url]
air travel to david panama travel space to molecule [url=]tour catering corporate[/url]
nam ho travel singapore restored vintage travel trailers [url=]caa travel south west ontario[/url]

Anonymous said...

good sams travel clubs salma shemale [url=]glamorous ladies stockingtops garters pissing[/url] tytan international twisted nylon twine don moen music [url=]grannies pissing pics[/url]
[url=]worlds most confortable thong[/url] anne hathways new movie big tit exhibisionist
travel tibet uncle mikes nylon shot gun slings [url=]mileys tits[/url] charlize theron prostitute scenes online new orleans jazz funeral music [url=]littel defloration[/url]