troubleshooting Question

Most efficient SQL Insert / update

Avatar of AlexPonnath
AlexPonnathFlag for United States of America asked on
Microsoft SQL ServerMySQL Server
17 Comments7 Solutions572 ViewsLast Modified:
Hi, wondering what the most effective way would be to do the folowing

i have 2 tables, one is current status 2md one is history of a device. I always want to keep the current info in one table and the
history in a second table, that way the current info table is smaller and faster and large querys on the history dont bug it down.
My question now is what is the easyest way to do this since i ultimatly have to either insert or update the current table and then
also insert into history table.

Is it better to go and query the current table and if no match insert, if match update  or just delete the record and always insert a new one ?

As for the history table depending on the above solution i could either query the current one and insert it into history or go and
just always insert into history as well as current table.

Just as a note there will be between 50000 and 100000 in the current table and there will be up to a 1 Mio updates per hr so thats why i am looking
for performance.


Dale Burrell

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 7 Answers and 17 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 7 Answers and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros