A very strange thing in the tempdb In all the following scenarios on my laptop, all the tables in the SSMS Tables folder will be deleted from tempdb:


Instance Restart;
Stop &amp; Start SQL Server Service;
End Task SQL Server process in task manager;
OS (WINDOWS) Restart.


I have no problems with the above.

But …

The following scenario is very interesting:

First, I create a table in tempdb:

USE tempdb;
GO
CREATE TABLE Test_Table
(ID INT,
Title VARCHAR(100));
GO
INSERT INTO Test_Table
VALUES
(1,'Test01'), (2,'Test02'), (3,'Test03');
GO


Then I exit SSMS and shut down Windows.

A few days later …

Turn on my laptop.

When I get into SSMS, I'm surprised to see that there is a Test_Table with its records in the tempdb. 

Why? I did not create such a table in the model database.

I thought so much about this.

Can the following explanations prove this hypothesis?

You should be aware that Windows shut down is much faster than restarting.

It is likely that in Windows restarting, the SQL Server service will also be restarted, and to end the service, it should release the resources it has, as well as empty the contents of tempdb. 

But in the Windows shut down process, the Windows shut down service is likely to be responsible for releasing resources, and in fact kill all processes, and obviously there is no accident in the tables in the Tables folder of tempdb, Because the SQL Server service does not restart.

I tested this in versions SQL Server 2019, 2017 and 2008.

Do you think your guess is correct?

I'd be happy to express your opinion about this.
You probably created another test_table in the model database, so then TempDB inherits that on startup.