R
Rogas69
Hi,
I am struggling against problem that is strange to me.
I have to insert large amounts of data into two tables. Data are generated
on the fly so there is no possibility of using bulk operations. I am using
stored procedure that performs several checks and inserts or updates data in
appropriate way.
Stored procedure is enclosed in transaction as it returns some data needed
for the second stage of processing. This is not the problem of commiting
every statement then.
I am using SqlCommand with CommandType.StoredProcedure type, so it is not a
problem of parsing SQL every time. I call ExecuteScalar method as procedure
returns string.
When I created empty database, 1000 records took about 7 seconds to be
stored. I inserted 1 000 000 records and now time of 1000 records is up to
50 seconds!, 25 on average .
I noticed that there are strange bottlenecks despite that there is only one
client for now that pushes data to database - sometimes profiler shows that
execution time of the procedure can take even more than 2 seconds, and
sometimes it takes only 15ms.
Database is very simple and has clustered indexes created on primary keys.
I created simple test in query analyzer to check if this is database issue.
5000 calls to stored procedure take only 7 seconds - in my opinion this
shows that the problem is somewhere in ADO.NET.
What do you think? I am stuck with this problem for three days.. I will
appreciate your opinions.
Peter
I am struggling against problem that is strange to me.
I have to insert large amounts of data into two tables. Data are generated
on the fly so there is no possibility of using bulk operations. I am using
stored procedure that performs several checks and inserts or updates data in
appropriate way.
Stored procedure is enclosed in transaction as it returns some data needed
for the second stage of processing. This is not the problem of commiting
every statement then.
I am using SqlCommand with CommandType.StoredProcedure type, so it is not a
problem of parsing SQL every time. I call ExecuteScalar method as procedure
returns string.
When I created empty database, 1000 records took about 7 seconds to be
stored. I inserted 1 000 000 records and now time of 1000 records is up to
50 seconds!, 25 on average .
I noticed that there are strange bottlenecks despite that there is only one
client for now that pushes data to database - sometimes profiler shows that
execution time of the procedure can take even more than 2 seconds, and
sometimes it takes only 15ms.
Database is very simple and has clustered indexes created on primary keys.
I created simple test in query analyzer to check if this is database issue.
5000 calls to stored procedure take only 7 seconds - in my opinion this
shows that the problem is somewhere in ADO.NET.
What do you think? I am stuck with this problem for three days.. I will
appreciate your opinions.
Peter