Command 1: (Get Count from View1)
Select Count(*) From View1
Results:
-----------
183
(1 row affected)
Execution time = 11 seconds
Command 2: (store the count in a table called Temp)
Drop Table Temp
Create Table Temp
(
C Int
)
Insert Temp
Select Count(*) From View1
(1 row affected)
Execution time = 29 sec`
Command 3: (Get all data from View1)
Select * From View1
Results:
-----------
All Data from the view.
(183 row affected)
Execution time = 11 seconds
Command 4: (store the View1 data in a table called Temp1)
Drop Table Temp1
Create Table Temp1
(
Columns same as View1
)
Insert Temp1
Select * From View1
(183 row affected)
Execution time = 29 sec
My Question
The SELECT in Command 1 and Command 3 is taking 11 seconds, why is INSERT SELECT in Command 2 and Command 4 taking 29 seconds, 18 seconds extra is way too much?
I have disabled Anti-Virus and Firewall. Closed Browser and all other apps. No download going on. Only SSMS is running. Only one instance of SQL Server is running. This computer is standalone, Windows 10 64 bit, 4 GB RAM. Enough disk space is free.