Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full Table Scan on Insert Causes Deadlock #112

Open
chezsmithy opened this issue Dec 12, 2019 · 0 comments
Open

Full Table Scan on Insert Causes Deadlock #112

chezsmithy opened this issue Dec 12, 2019 · 0 comments

Comments

@chezsmithy
Copy link

We are noticing the following insert issue:

Mysql2::Error: Deadlock found when trying to get lock; try restarting transaction: INSERT INTO read_marks (reader_id, readable_type, timestamp, reader_type) VALUES (502537, 'Activity', '2019-12-12 16:44:18', 'User')

It appears when a user is being setup as a reader, they are being initialized in the table without a readable_id. Due to the unique index on the read marks table, the MYSQL database falls back to a full table scan, rather than a full index scan which would be slower.

The table scan escalates a full table lock, and then blocks other insertions causing a deadlock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant