February 11, 2014 at 7:41 am
I'm facing an issue here. I have one procedure which inserts data in a table with the help of some joins in few tables. Now there are around 1000 records to be inserted as a result of execution of that procedure. But the problem is that it's inserting one recor at a time. I have updated the statistics of all the dependent tables. There is no index on the table where data getting inserted. What can be the issue ? It's taking almost an hour to insert 1000 records.
February 11, 2014 at 7:44 am
one record at a time?!?!
can you show the code for the procedure? does it have a cursor? are there triggers ont he destination table? does the trigger have cursors?
lots of possible issues, but without details, we can't offer much more than general guidelines: no cursors, no loops, etc
Lowell
February 11, 2014 at 8:03 am
Nope there are no cursors used. But I can see the execution plan for the table. And it shows almost 75% of the time taken for Insertion operation.
Attached is the print screen of execution plan. I had to hide the object's name.
February 11, 2014 at 8:09 am
don't get caught up staring at the percentages; they have to add up to 100, so just because something is 75% doesn't mean it's bad, it just means that's where work was performed compared to other steps.
i put more importance on things like the estimated number of rows inserted being 19213 and the estimated subtree cost being 87.8014 than anything else.
you said it inserts one at a time, but this looks set based.
can you obfuscate the insert statement and show it to us? the actual execution plan would tell us everything, if you can post that.
Lowell
February 24, 2014 at 3:10 pm
It's hard to tell without seeing the actual insert statement or the execution plan. Please post it if possible ..
--
SQLBuddy
February 24, 2014 at 5:07 pm
Does the table have a trigger?
February 25, 2014 at 12:34 pm
sqlnaive (2/11/2014)
I'm facing an issue here. I have one procedure which inserts data in a table with the help of some joins in few tables. Now there are around 1000 records to be inserted as a result of execution of that procedure. But the problem is that it's inserting one recor at a time. I have updated the statistics of all the dependent tables. There is no index on the table where data getting inserted. What can be the issue ? It's taking almost an hour to insert 1000 records.
Have you tried to use other account to execute the SQL?
Have you tried to load all related data into other database and run again, take a look what happens?
it might be caused by database configuration.
February 25, 2014 at 5:39 pm
sqlnaive (2/11/2014)
I'm facing an issue here. I have one procedure which inserts data in a table with the help of some joins in few tables. Now there are around 1000 records to be inserted as a result of execution of that procedure. But the problem is that it's inserting one recor at a time. I have updated the statistics of all the dependent tables. There is no index on the table where data getting inserted. What can be the issue ? It's taking almost an hour to insert 1000 records.
Please see the second link under "Helpful Links" in my signature line below. That's the information that we'd need to help you solve this problem.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply