isolation-level

Why does my SQL Server UPSERT code sometimes not block?

纵然是瞬间 提交于 2021-02-08 20:46:07
问题 I have a table ImportSourceMetadata which I use to control an import batch process. It contains a PK column SourceId and a data column LastCheckpoint . The import batch process reads the LastCheckpoint for a given SourceId , performs some logic (on other tables), then updates the LastCheckpoint for that SourceId or inserts it if it doesn't exist yet . Multiple instances of the process run at the same time, usually with disjunct SourceIds , and I need high parallelity for those cases. However,

Node.js single-thread mechanism

雨燕双飞 提交于 2021-01-28 21:32:42
问题 I learnt Node.js is single-threaded and non-blocking. Here I saw a nice explanation How, in general, does Node.js handle 10,000 concurrent requests? But the first answer says The seemingly mysterious thing is how both the approaches above manage to run workload in "parallel"? The answer is that the database is threaded. So our single-threaded app is actually leveraging the multi-threaded behaviour of another process: the database. (1) which gets me confused. Take a simple express application

Transactions, locks, isolation levels

巧了我就是萌 提交于 2020-07-17 08:45:27
问题 I have a few questions regarding subject from the title. First of all, lets assume that we work with JDBC, and there we have 2 transactions T1 and T2. In T1 we execute select statement on one particular row. Then we execute update on that row. In transaction T2 we execute select statement on the same row. Here are the questions: 1) When does transaction T1 acquire the lock on mentioned row? I assume it happens during select statement execution? 2) How long transaction T1 holds the lock? Does

BeginTransaction with IsolationLevel in EF Core

半城伤御伤魂 提交于 2020-04-09 18:41:12
问题 I'm trying to rewrite old library to use EntityFramework Core and I can't figure out how to begin transaction with specific isolation level. Previously I was able to do something like this: DbContext.Database.BeginTransaction(IsolationLevel.Snapshot); What is alternative implementation in the EntityFramework Core? 回答1: The EF Core code is exactly the same. DbContext.Database.BeginTransaction(IsolationLevel.Snapshot); The only difference is that in EF Core the method with isolation level (as

BeginTransaction with IsolationLevel in EF Core

我怕爱的太早我们不能终老 提交于 2020-04-09 18:41:11
问题 I'm trying to rewrite old library to use EntityFramework Core and I can't figure out how to begin transaction with specific isolation level. Previously I was able to do something like this: DbContext.Database.BeginTransaction(IsolationLevel.Snapshot); What is alternative implementation in the EntityFramework Core? 回答1: The EF Core code is exactly the same. DbContext.Database.BeginTransaction(IsolationLevel.Snapshot); The only difference is that in EF Core the method with isolation level (as

What specific exceptions represent a serialization failure when Django is using serializable transaction isolation level with postgresql?

女生的网名这么多〃 提交于 2020-03-21 20:28:27
问题 Sometimes it's desirable to use a higher isolation level than the default "read committed" for database operations in Django. The docs warn that: Under higher isolation levels, your application should be prepared to handle exceptions raised on serialization failures. But which specific exceptions indicate a serialization failure, versus some other problem with the query or transaction? A simple retry mechanism after a serialization failure might look like something like this: for retries in

when/what locks are hold/released in READ COMMITTED isolation level

主宰稳场 提交于 2020-02-17 23:03:34
问题 I am trying to understand isolation/locks in SQL Server. I have following scenario in READ COMMITTED isolation level(Default) We have a table. create table Transactions(Tid int,amt int) with some records insert into Transactions values(1, 100) insert into Transactions values(2, -50) insert into Transactions values(3, 100) insert into Transactions values(4, -100) insert into Transactions values(5, 200) Now from msdn i understood When a select is fired shared lock is taken so no other

when/what locks are hold/released in READ COMMITTED isolation level

末鹿安然 提交于 2020-02-17 22:56:29
问题 I am trying to understand isolation/locks in SQL Server. I have following scenario in READ COMMITTED isolation level(Default) We have a table. create table Transactions(Tid int,amt int) with some records insert into Transactions values(1, 100) insert into Transactions values(2, -50) insert into Transactions values(3, 100) insert into Transactions values(4, -100) insert into Transactions values(5, 200) Now from msdn i understood When a select is fired shared lock is taken so no other

TransactionScope and Connection Pooling

折月煮酒 提交于 2020-01-22 18:40:51
问题 I'm trying to get a handle on whether we have a problem in our application with database connections using incorrect IsolationLevels. Our application is a .Net 3.5 database app using SQL Server 2005. I've discovered that the IsolationLevel of connections are not reset when they are returned to the connection pool (see here) and was also really surprised to read in this blog post that each new TransactionScope created gets its own connection pool assigned to it. Our database updates (via our

TransactionScope and Connection Pooling

僤鯓⒐⒋嵵緔 提交于 2020-01-22 18:40:46
问题 I'm trying to get a handle on whether we have a problem in our application with database connections using incorrect IsolationLevels. Our application is a .Net 3.5 database app using SQL Server 2005. I've discovered that the IsolationLevel of connections are not reset when they are returned to the connection pool (see here) and was also really surprised to read in this blog post that each new TransactionScope created gets its own connection pool assigned to it. Our database updates (via our