• Ed Wagner - Tuesday, November 21, 2017 11:17 AM

    Lynn Pettis - Tuesday, November 21, 2017 11:03 AM

    Hugo Kornelis - Tuesday, November 21, 2017 10:57 AM

    GilaMonster - Tuesday, November 21, 2017 10:23 AM

    Ed Wagner - Tuesday, November 21, 2017 5:34 AM

     why tempdb shows up later - I'm thinking it depends on how long it takes to create the files and size them up to the initial size.

    The only time the TempDB files are created is if they don't exist. Otherwise they're resized and the contents of Model are copied across (mostly, don't put several GB of tables into model)

    Are you sure?
    Asking because (1) sys.databases always has the last restart date and time as create_date of tempdb; and (2) last change date in the file system for a running instance is startup time for tempdb files as opposed to last shutdown time for other databases; and (3) create date in the file system for tempdb files is same as startup time. In other words, this all suggests that the files are deleted and then cleanly allocated.

    The created date would be changed if the files are physically dropped and recreated.  I am only seeing the modified date changing when SQL Server is restarted.

    I see the same thing in the file system, but I only checked one server.  The create date is February 2013 and the server has most certainly been rebooted since then.
    The sys.databases.create_date and file system modified date both show the last reboot time.
    So what Gail said holds true.  Thanks to both Gail for the info and Lynn for the good test.  I'd know about sys.databases, but never checked the file system dates.

    Huh? That's weird. I though I saw the create date equal to the last startup date so I was flabbergasted by your replies. Went back to the filesystem to make a screenshot ... and found that I must have looked wrong or so. Create date is indeed much longer ago.
    Thanks for putting me straight!


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/