17,092 questions
-3
votes
0
answers
43
views
Avoiding counter update contention under high write throughput [closed]
We maintain multiple counters where each incoming request increments or decrements one or more counters. These counters are bounded by a max value, once that is reached, we reject the requests.
...
0
votes
1
answer
64
views
Does PostgreSQL read committed isolation level guarantee 2 transactions: subtract 3 and subtract 5 together always result 10 - 8 = 2?
Does PostgreSQL read committed isolation level guarantee 2 transactions: subtract 3 and subtract 5 together always result 10 - 8 = 2 ?
i.e. PostgreSQL
Origin_value = 10
1 Tr = 1) read Origin_value 2) ...
Best practices
0
votes
4
replies
139
views
How to ensure an inserted row survives a rollback?
In SQL Server, I have a stored procedure that returns some sensitive data to the client, and logs that fact into a log table. The stored procedure is executed in a transaction controlled by the client,...
0
votes
0
answers
56
views
Why does MSDTC tracing fail to write any logs?
Per all documentation I can find for the MSDTC tracing feature, selecting "Trace All Transactions" should provide a trace file that can be formatted and read. I have tried for several days ...
0
votes
0
answers
49
views
MikroORM @Transactional decorator isn't working with MongoDB
I am new to MikroORM and having trouble using @Transactional decorator. Below is my code.
Model:
import { Entity, PrimaryKey, Property } from '@mikro-orm/core';
import { ObjectId } from 'mongodb';
@...
1
vote
1
answer
122
views
is @Transactional(isolation = Isolation.REPEATABLE_READ) enough for safe incrementing?
Is it possible to lost increment here? If not, is it possible in case of read_commited level?
@Transactional
public updateProductStatistics(Long productId) {
ProductStats stats = ...
Best practices
0
votes
0
replies
57
views
What's the best practice of distributed transaction implementation for java/spring based service
I am going to try to implement such thing and thinking about the best practice. Of caurse I know about some patterns like SAGA with transaction outbox but I never used it in practice. Is there any ...
1
vote
0
answers
49
views
Data Ownership and Transaction Managment in SOA
I'm trying to learn more about Service Oriented Architecture as to me, it seems like a good middle ground between monolithic and micro service applications. Please correct me if I'm wrong but the ...
1
vote
1
answer
61
views
In a MongoDB transaction, are index entries updated immediately when an indexed field is modified?
I'm working with MongoDB transactions (Node.js, replica set). Inside a transaction, I update a document in a way that changes the value of a field that is covered by an index. Later in the same ...
Best practices
0
votes
7
replies
109
views
MySQL SELECT … FOR UPDATE causing table lock during high traffic while generating sequential transaction IDs
I have a PHP + MySQL project where I need to generate sequential transaction IDs.
Each transaction can have multiple items, so all rows for that transaction must share the same txn_in value.
Tables
...
1
vote
2
answers
128
views
CREATE OR REPLACE FUNCTION in concurrently running transactions
How does create or replace function in PostgreSQL 14 behave with respect to transactions? If there are multiple concurrent transactions running at read committed isolation level, and trying to create ...
0
votes
1
answer
57
views
Can I remove the pg_try_advisory_lock() call for function run_maintenance_proc() generated by pg_partman extension?
Why does the PostgreSQL run_maintenance_proc need pg_try_advisory_lock? Can I remove that? It keeps creating table deadlocks.
Its probably because I am also using dbt to generate a few materialized ...
Advice
0
votes
3
replies
65
views
How to use Read Stability in db2 interactive SQL
I'm experimenting with DB2 isolation levels. I've installed DB2 12.1.1 for Linux on Ubuntu 22.04 and created a user & instance. Now I'd like to open two sessions and step-by-step type SQL commands,...
2
votes
1
answer
84
views
Purpose of WriteCommitted isolation transaction level (Golang database/sql package)
In Golang, database/sql package, there is a constant such as LevelWriteCommitted for the IsolationLevel type
https://pkg.go.dev/database/sql#IsolationLevel
What is the purpose of this level? There is ...
2
votes
1
answer
96
views
Django transaction.atomic() on single operation prevents race conditions?
Why I need to use atomic() when I have only 1 db operation inside atomic block? My AI-assistant tells me that it prevents race conditions, but I don't use select_for_update() inside. It tells that db ...