We got locks in DB without parallel update operation, one exclusive and number of shared. Here are tables:
create table a (
key1 int,
key2 long,
key3 tinyint,
val text,
primary key(key1, key2, key3)
);
create table b (
key1 int,
key2 long,
anotherval text,
primary key(key1, key2)
);
key1 and key2 in tables are identical in names and values, and there is smth about 1bln records, with 4000 unique key1 in tables. key3 is archaic, and is not neccessary at all, cause the pair key1+key2 is unique itself. But we cannot simply erase it - too many records.
Now realize we perform operations in parallel:
select a.val, b.anotherval
from a left join b using (key1, key2)
where key1 = 123 and key2 >=100000 and key2 <900000;
and
delete from a where key1=123 and key2 >300000;
so can this generate such lock?