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

Feature Request: option to optimize locking for lookup Vindexes #11612

Closed
maxenglander opened this issue Nov 1, 2022 · 0 comments · Fixed by #11538
Closed

Feature Request: option to optimize locking for lookup Vindexes #11612

maxenglander opened this issue Nov 1, 2022 · 0 comments · Fixed by #11538

Comments

@maxenglander
Copy link
Collaborator

maxenglander commented Nov 1, 2022

Description

DML statements involving lookup vindexes perform locking reads on rows in the lookup backing table. It would be nice if there were an option to optionally skip or relax this lock for cases where we are confident that the business logic will not cause those rows to be deleted or changed.

Details

When a lookup vindex is used in a query, a SELECT lookup query is sent to the backing table that looks like this:

SELECT [from_column], [to] FROM [backing_table] WHERE [from_column] IN (?)

When the query that triggered the lookup query is a DML statement occurring inside a transaction, the lookup query is turned into a locking read:

SELECT [from_column], [to] FROM [backing_table] WHERE [from_column] IN (?) FOR UPDATE

The locking read is was added as a way to prevent concurrent DML causing locking/hanging in some scenarios.

Use cases

This locking read is a great safety feature that comes with performance cost. If a Vitess user is sure that these sorts of concurrent DML scenarios (updates together with inserts in transactions) won't occur on the backing table, then that user could take advantage of this feature to gain some extra performance.

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

Successfully merging a pull request may close this issue.

1 participant