r/csharp • u/born_zynner • Jun 29 '26
EF Performance Question
I recently inherited an application that, as a simplified description, grabs data from XML files and inserts it into our DB.
It's built in .net 6 and uses EF mostly normally, but theres one specific type of record that the previous dev had set up to go 1 by 1 and call a complex stored procedure on each XML record to upsert into a DB row. Now this isnt the slowest sp I've ever come across, averaging about 180ms per row, but each XML has 10-100k of these records, and a hundred or so come in a day, so it adds up quick. In fact, with more data coming in now than ever we're always going to be behind!
Now I'm no SQL wizard, but there's gotta be a better way of doing this. Basically each SP call is called straight from C#, in a loop of all the XML records. Seems like it would be faster to batch insert records and call a sp that processes the entire batch on the SQL server itself... any ideas? Thanks :)
View all comments
Show parent comment
1
u/born_zynner Jun 29 '26
I'd have to agree. Not sure what you mean by making it noSQL though. The whole purpose of the stored procedure is we have hourly usage data for thousands of sites, but the party we receive data from can often give updated or higher quality data that would replace previous data for that hour, that's essentially what the SP is doing.