Questions tagged [database-locking]
129 questions
1
vote
0 answers
Out of shared memory errors when doing a select query
Using: Postgres 10.2
Ignoring some unrelated columns, I have the table animals with these columns (omitting some unrelated columns):
animalid PK number
location (text)
type (text)
name (text)
data (jsonb) for eg: {"age": 2, "tagid": 11 }
Important…

Chillax
- 4,418
- 21
- 56
- 91
1
vote
1 answer
Can a insert operation make another DDL operation wait?
I am trying to understand the reason why i get the below error.
`ORA-04021: timeout occurred while waiting to lock object`
This error is thrown from a procedure while running the command alter table <> truncate subpartition…

Divya MV
- 2,021
- 3
- 31
- 55
1
vote
1 answer
How can I implement a transaction of 50 writes in dynamoDB?
I’m aware there is a hard limit of 25 items per transaction. However, I’m sure there is a way of implementing transactions for more items from scratch. How might I go about it?
I’m thinking something like, keep a version number on every item. Fetch…

david_adler
- 9,690
- 6
- 57
- 97
1
vote
0 answers
how to change default db from sqlite to postgresql/mysql in jupyter notebook
I can see there are some config options in jupyter_notebook_config.py related to default database which is sqlite
## The sqlite file in which to store notebook signatures. By default, this will
# be in your Jupyter data directory. You can set it to…

Girish Gupta
- 1,241
- 13
- 27
1
vote
1 answer
How can I find out what is holding a PgLock advisory lock in the Postgres database?
I'm using the pg_lock gem to manage Postgres advisory locks for coordinating between processes to avoid race conditions. I have a lock that is failing with an error about Was unable to aquire a lock "my_lock_name" after N attempts, which tells me…

Wolfgang
- 3,470
- 1
- 20
- 36
1
vote
1 answer
BLink Tree insert operation
The B-link tree introduced in Lehman and Yao (1981) claims that any insert operation need at most 3 locks simultaneously.
I have a hard time to find a concrete scenario where 3 locks are acquired. What is the scenario?

Ginda Chen
- 81
- 7
1
vote
0 answers
Can pessimistic locking be implemented using mysql and innodb?
The flow for locking I have currently is a SELECT ... FOR UPDATE followed by an INSERT. e.g.
BEGIN;
SELECT count(*) FROM test WHERE col = 1 FOR UPDATE;
# check to ensure an invariant will still be met after the insert.
INSERT INTO test (col) VALUES…

dolan
- 1,716
- 11
- 22
1
vote
1 answer
Error DB Locked in Android SQLite Xamarin Forms
I'm working on a App that have more than 50 tables and can work without internet connection, so in background the app can sync up with the API and get all the information and make the CRUD operation in local.
Sometimes when the app is sync up with…

Eleazar Saavedra
- 31
- 7
1
vote
1 answer
Does updating a column with foregin key contraint can lock the referenced table?
I have one table, which is heavily updated in my system by process A. This is the simplified table:
db=# \d employee;
Table "public.employee"
Column | Type | Collation |…

Tomer
- 2,398
- 1
- 23
- 31
1
vote
1 answer
How database locks and web server collaborate with respect to database sessions?
This question has a wide area set, e.g. web servers, database servers, php application, etc and hence I doubt it belongs refers to stackoverflow, however since this question will help us on how to write the application code, I have decided to ask it…

Musa Haidari
- 2,109
- 5
- 30
- 53
1
vote
1 answer
Does SELECT prevent returned rows from getting deleted?
Say I have:
T1: SELECT id FROM x WHERE timestamp < y (returns id = [1, 2, 3])
T2: DELETE FROM x WHERE id = 1
T1: SELECT timestamp, value FROM x WHERE id = 1
with READ-COMMITTED isolation.
Does step 3 run the risk of returning an empty result, or…

Gili
- 86,244
- 97
- 390
- 689
1
vote
2 answers
Detect the cause of SQL Server update lock
Problem:
A .NET application during business transaction executes a query like
UPDATE Order
SET Description = 'some new description`
WHERE OrderId = @p1 AND RowVersion = @p2
This query hangs until timeout (several minutes) and then I get an…

FireAlkazar
- 1,795
- 1
- 14
- 27
1
vote
2 answers
Why UPDATE blocks SELECT on unrelated rows?
Having the table, defined by script [1], I execute scripts in 2 windows of SSMS
--1) first in first SSMS window
set transaction isolation level READ UNCOMMITTED;
begin transaction;
update aaa set Name ='bbb'
where id=1;
-- results in "(1…

Gennady Vanin Геннадий Ванин
- 10,136
- 11
- 75
- 106
1
vote
1 answer
Lock-data:supremum pseudo-record in MySQL5.7.11 with REPEATABLE-READ
MySQL5.7.11, tx_isolation is REPEATABLE-READ;
Table like this:
CREATE TABLE a (
id int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
insert into a values(1);
in session1, execute like this:
begin;
select * from a…

Wang Wen'an
- 312
- 2
- 8
1
vote
2 answers
Which data is locked when database lock occurs?
I read that
"A lock occurs when multiple users need to access a database concurrently.", (ref)
or
"database locks exist to prevent two or more database users from updating the same exact piece of data at the same exact time" - (ref).
Still, I…

toby_yo
- 179
- 2
- 15