|  | 
| SQL Server rebuilds the tempdb database every time the service is restarted 
 If the tempdb grows automatically due to the need during the system operation, SQL Serve will not remember the size after growth, and it will return to the original size after restarting the service.
 But if the user used to manually adjust the size of tempdb, restarting the service SQL Server will rebuild tempdb to the user specified size
 
 Test example
 
 tempdb initialized to 8MB
 
 1) Make tempdb grow automatically
 
 select b. * into #t from sysprocesses a, sysobjects b
 
 Use sp_helpdb 'tempdb' after restart
 You can see that tempdb is restored to 8MB
 
 2) Users use Alter Database to adjust to 100MB,
 
 USE master
 GO
 ALTER DATABASE tempdb
 MODIFY FILE
 (NAME = tempdev, SIZE = 100MB)
 
 After restarting the service, the size of tempdb is 100MB.
 
 The following query can see the changes in tempdb
 select a.filename, a.name, a.size * 8.0 / 1024.0 as originalsize_MB,
 f.size * 8.0 / 1024.0 as currentsize_MB
 from master..sysaltfiles a join tempdb..sysfiles f on a.fileid = f.fileid
 where dbid = db_id ('tempdb')
 and a.size <> f.size
 | 
 |