0

My issue: I have a real time app that need to save 1000 insert's into SQL Server every second but when I try to select all the rows from the table "X", it is still populating after I already closed the application. I already dropped the primary key from that table and still didn't work fast. After that I tried to use on C# context.ExecuteCommand("INSERT INTO") because I didn't have a primary key and that is it, slow anyway. Also I tried to add WITH (TABLOCK) on the table and the same thing.

Question: How can I have a lot of insert's every second without having this kind of issue? My insert are too slow, "taking so long to save into the database".

Thank you for any help.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Looks like it's merely a case of your application having processes/threads still running while the 'UI' has been closed. – Rob Feb 14 '17 at 22:57
  • Hi Rob, I know that there are threads still running, My issue is how to have a lot of insert's every second in my database. I am using a real time application to save, let's suppose the user mouse position every second. Thank you – Gerson Junior Feb 14 '17 at 23:04
  • I'm still unclear as to the problem here: do you want to prevent a user closing the application while inserts are still happening? Or do you want to force the inserts to stop when the application is closed? Or are you saying the inserts are not fast enough ? – Rob Feb 14 '17 at 23:06
  • Hi Rob, The insert isn't fast enough. – Gerson Junior Feb 14 '17 at 23:10
  • In that case, take a look [here](http://stackoverflow.com/questions/13722014/insert-2-million-rows-into-sql-server-quickly) – Rob Feb 14 '17 at 23:11
  • Rob, my situation is: I am trying to track the user mouse position on my website using SignalR. So every time that the user move his/her mouse I save that position into my database with an Insert but it is taking so long to save that data. Thank you, I will take a look into SqlBulk but I don't know if it will work in my case. – Gerson Junior Feb 14 '17 at 23:15

0 Answers0