I am looking for something similar to SQL transaction. I need the usual protection that transactions provide, but I do not want it to slow down others.
Imagine that client A connects to the database and executes the following commands:
BEGIN TRAN SELECT (something) (Wait a few seconds maybe.) UPDATE (something) COMMIT
Between SELECT and UPDATE, client B comes in and tries to execute a query that, under normal circumstances, will have to wait for A to be COMMIT.
I would like client A to open the transaction so that B comes in and executes the request, client A finds that the transaction is immediately rolled back and subsequent commands are not executed. Client B will experience minimal delay.
(Note that SELECT and UPDATE are merely illustrative.)
Updating ...
I have a high priority task (client B) that sometimes (once a month) gets an SQL timeout error and a low priority task (client A) with a transaction that causes this timeout. I would prefer the low priority task to fail and restart in the next loop.
In the end, I solved this problem by completely eliminating transactions and replacing them with an unofficial set of flags. The requests were reorganized only to do something only if the correct set of flags was raised, and I added something that cleared the abandoned records that the rollback had deleted in the past.
I fixed my transactions by excluding transactions.
source share