Using: SQL Server 2008 R2
I'm seeing some behavior right now in SQL Server, and I can't decide if the server is underperforming or not.
I've set up a test to insert an integer into a table, as defined below, 75,000 times.
dbo.Test1
(
id INT IDENTITY(1,1)
, [text] VARCHAR(2000)
, [timestamp] DATETIME NOT NULL DEFAULT(GETDATE())
)
Both the application (C# code below) inserting the data and the SQL Server instance are on the same physical box.
The results: the process is taking almost 10 minutes to loop and insert the data. Not really sure how this can be possible...
for (int i = 0; i < 75000; i++)
{
using (SqlConnection connection = new SqlConnection(@"<server>"))
{
connection.Open();
using (SqlCommand command = new SqlCommand("INSERT INTO dbo.Test1 ([text]) SELECT '" + i + "'", connection))
{
command.ExecuteNonQuery();
}
connection.Close();
}
}
EDIT:
Update to question as per @AaronBertrand's response.
How big is i? As I specified, it's an integer in a loop. I don't care about text that may or may not go in the text column.
What kind of drives? It's a 7200 SATA (http://www.seagate.com/ww/v/index.jsp?vgnextoid=2ee06c02c732f110VgnVCM100000f5ee0a0aRCRD)
Is the database tiny? Yes, this is a possible issue.
Is the database remote? Please read the question more closely. Everything is on the same physical box, right in front of me. Same issues with two boxes across a network though, but I'm not trying to debug network issues right now. Just SQL Server insert issues.
Good money's on the autogrow issue right now.
EDIT 2:
Update again. Thanks in advance for taking the time to read/respond.
Is the machine a VM? No VM, thank god.
Application connection method Researching that. Since everything's on the same box, I'm not sure how it connects.
Triggers None
Resource governor Not set up.
Profiler The profiler doesn't show any delays whatsoever, which is bugging the hell out of me.
Blocking This is the only thing happening, so there shouldn't be any blocking or waits, perhaps excluding log waits. On my box, everything's on the same physical disk. However, (big however) on other boxes with the same problem this is NOT the case, so I will not pursue this as a problem at this time.