Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a scenario that inserting bulk records into sqlserver table.
Here i am validating each record-column value based on some condition.

So i have one temporary table, from that table each and every record i am moving to original table after validation.

My problem is,
when the first time i am inserting records it is ge tting loaded veryfast.It takes around 3-5 mins for 100000 records.if i insert 200000 then 10 mins .But when i am trying to insert next time ie,1000 records for the next time(means after an hour or two)it is getting very slow.

If i truncate all values from original table and started the process again ,then its loading very fast.

Why this happens?

Can anybody tell the reason?
And also help me to solve this issue.
please.....
Posted

1 solution

Your database gets slower as it has to insert more entries. I'd guess the reason has to do with indexes you have set up on the table. Does it have a clustered index ? That makes lookups fast, but inserts get slower as the table size grows.
 
Share this answer
 
Comments
Arun.Mohandas 14-Nov-12 10:43am    
thanks for your reply,
yes, initially i was having index.but i removed the index and tried.but no change.
My doubt is ,if i insert 300000 records also first time it is inserting fast.but for second time its getting slow even if i try for 1000 records.Why?
Christian Graus 14-Nov-12 10:44am    
The answer is obvious. Once you have a lot of records, it is more expensive to add more. The reason has to do with your indexing, I am sure.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900