Click here to Skip to main content
12,758,051 members (33,012 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL-Server
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 14-Nov-12 5:30am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
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)

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100