August 15, 2022 at 11:51 am
for suppose, my colleague is loading data in a table at same time i want to read that table without any interrupting his loading?
how can i do that?
August 15, 2022 at 6:39 pm
The best way is to not read the same area of the table that he's writing to. It's also important that his "loading" should be fast. Some will suggest the use of "WITH (NOLOCK)" or setting the transaction isolation level to "Read Uncommitted". Both of those are usually really bad ideas.
You could also use WITH (READ PAST) to read only those things that are not locked but that can also be an issue.
The best way is to make the "Loading" as fast as possible and have the "read" code simply wait.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply