Freeing up space on mdf file.

  • Hello 

    Is there anyway to free up some more space on a mdf file without shrinking it?

    Thanks

  • Funny you should bring this up...

    I'm working on (but have not yet completed) a method to determine which index/heap the last page of an MDF file maps to, rebuilds that index (which will free that page), then wash, rinse, and repeat so that a shrink with TRUNCATE-only would do the trick without inverting any indexes.  The big trick is knowing when to quit because any index over 128 extents (just 8 MB) will cause the old index to persist until a new organized copy of the index is committed.  That could take you past the current end of the file and you'd suffer from possibly recursive expansion of the MDF.

    And, yeah... it would have been real nice if MS thought of such a thing (Peter Norton disk organization method) when the wrote the shrink-file code.  Seems like it would have taken about two extra steps.

    Other than that, you need to "get lucky".

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply