I have a spring boot application where I'm running a native query.
UPDATE users
SET status = "A"
, user_id = '1234567'
WHERE card_id = ( SELECT card_id FROM ( SELECT * FROM users d WHERE d.status = "U" LIMIT 1 ) d1) AND status = "U";
In user table,
card_id is primary key,
user_id is unique key.
The table contains lots of cards with different statuses(maximum of 4 statuses) I need to pick a row with status "U" and assign a user to that row.
Looks like the table is getting locked at some place.
I've around 5 million records. And when running around 40 concurrent users, single calls is taking around 40 seconds.
Thanks.