Click here to Skip to main content
15,881,687 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi,

I have a big problem while inserting the records in database.
In my job table I have 20 laks of records. When I inserting the new record first I will check based on some fields(like url, location..etc) if the record is exist or not.
Each and Every field check 17 laks of records before inserting. Now I got timeout error while inserting the records. Now the records are increased daily.
My server configurations is 32 gb ram and 2 TG harddisk.

Please give me the suggestions.
Thank you....
Posted
Comments
Maciej Los 22-May-14 2:47am    
And what have you tried till now?
NagaRaju Pesarlanka 22-May-14 2:48am    
try to find the solution.
Bh@gyesh 22-May-14 2:50am    
Try to increase "ConnectionTimeout in web.config. If it is not working then, try to increase commandTimeout in command property.
Kornfeld Eliyahu Peter 22-May-14 2:57am    
Why to check existence with code - use SQL fro that (index, foreign key, constrains)
NagaRaju Pesarlanka 22-May-14 3:00am    
Please give one example link or code.

1 solution

Add an additional unique constraint to your table, such that fields which you check for duplicates are guaranteed to be unique by SQL Server already.
You can set constraints e.g. with SQL Server Management Studio (click on the table - then Constraints - then "New Constraint").
An index could do so, too.
 
Share this answer
 

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