tempdb: only one of several data files is growing on Index-Reorg

  • Hello there,

    I'd like to understand a special behaviour.

    Our tempdb-database is configured having 8 data files. As Microsoft recommends we have one data file for each core, all having same file size and grow rate.

    When we start index reorganisation (NOT rebuild!) on a very big table the tempdb grows (of course).

    I wonder why only 1 of the data files is growing. One might think that all the data files would grow at the same time, maybe approxemately by the same size.

    Does anyone have an explanation for this behaviour?

    I personally think that the reorg-process uses only one processor and so the tempdb-file assoziated with this processor at excution time will grow whereas the other files remain in their size.

    By the way: If so, is there a possibility using more than one core for the reorg-process? I think it would be faster than. But the maxdop-option is only available for index-rebuild.

    Thank's a lot, Wolf

  • WolfgangE (1/24/2013)


    Our tempdb-database is configured having 8 data files. As Microsoft recommends we have one data file for each core, all having same file size and grow rate.

    http://www.sqlskills.com/BLOGS/PAUL/post/A-SQL-Server-DBA-myth-a-day-%281230%29-tempdb-should-always-have-one-data-file-per-processor-core.aspx

    When we start index reorganisation (NOT rebuild!) on a very big table the tempdb grows (of course).

    Why 'of course'? Index reorgs shouldn't hit tempDB heavily, if at all, unless you have one of the snapshot isolation levels in use. Index reorgs use a single spare page in the user database to do the reorganisation. It's the index rebuilds (with sort in tempDB or online on) that hit TempDB hard.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Our tempdb-database is configured having 8 data files. As Microsoft recommends we have one data file for each core, all having same file size and grow rate.

    They also recommend sizing the tempdb files accordingly (for you anticipated usage) and disabling the autogrowth. Please read through the link Gail has posted.

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • Thank's for the answers and the link. I'll go trough it in detail.

    Yes, we have snapshot isolation set to on. I can see that during reorganisaton of our largest table the disk space of the tempdb disk is reduced dramatically (it's just because our monitoring sends a warning).

  • Right, so the TempDB usage is not due to the reorg using TempDB, it's the snapshot isolation and the row version store.

    To be honest, I'm not 100% sure how the row version store interacts with multiple files.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (1/24/2013)


    it's the snapshot isolation and the row version store.

    I'm not familiar with this term but I'll try to learn a bit more about it and why it affects our tempdb that way.

    Thank you 🙂

  • GilaMonster (1/24/2013)


    To be honest, I'm not 100% sure

    Shock, horror.

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

Viewing 7 posts - 1 through 6 (of 6 total)

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