We are trying to update the 20000 records in single commit which is taking more than 30 minutes. We are thinking to reduce the records counts and implementing the batch process which will commit the 1000 records. Can any provide the suggestion to improve the performance?
By default, EF does 1 query for single update. You can write stored procedure accepting table valued parameter, thus updating multiple rows with single query, reducing roundtrip overhead.
Also for bulk inserts you can use
Update: alternatively you can use 3rd party libraries to do this. Something like https://entityframework-plus.net/?z=ef-extended and https://entityframework-extensions.net/ I also used simple wrapper over SqlBulkCopy for bulk inserts.
Update2: Example from Microsoft how to use Table Valued Parameters: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/table-valued-parameters That is for ADO.Net, but similar approach is possible with EF.