Let's imagine you have a table with this definition:
CREATE TABLE public.positions
(
id serial,
latitude numeric(18,12),
longitude numeric(18,12),
updated_at timestamp without time zone
)
And you have 50,000 rows in such table. now for testing purposes you will run an update like this:
update positions
set updated_at = now()
where latitude between 234.12 and 235.00;
that statement will update 1,000 rows from the 50,000 (in this specific dataset)
if you run such query in 30 different threads, MySQL innodb will succeed and postgres will fail with lots of deadlocks.
why?