-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
sql/opt/exec: perform implicit SELECT FOR UPDATE on UPDATE with index join #45511
Comments
If we want to match increasingly complex patterns, we'll probably want to fold the matching and analysis into the explorer rather than execbuilder. When I first thought about doing this, I was worried about the cost of recreating the A different idea which lets us integrate with the explorer but avoids the cost of recreating subtrees is to put a locking flag in the mutation operator. This flag would mean, "lock every scan in the scope of this subtree". When the execbuilder sees this flag, it'd set |
All that said, I'm not opposed to adding this new pattern directly to execbuilder for 20.1. |
… join Fixes cockroachdb#45511. This commit enables implicit row-level locking on UPDATEs with an index-join in its initial row scan. To support this, two new patterns were needed in `Builder.shouldApplyImplicitLockingToUpdateInput`: ``` (Update $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $checks:* $mutationPrivate:* ) AND (Update $input:(Project $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $projections:* $passthrough:* ) $checks:* $mutationPrivate:* ) ``` These extra patterns are pushing the limits of this form of pattern matching, but this is ok for the next release. If/when we want to make any more general, we should strongly consider Andy's proposal to fold the patten matching and analysis into the explorer rather than execbuilder.
… join Fixes cockroachdb#45511. This commit enables implicit row-level locking on UPDATEs with an index-join in its initial row scan. To support this, two new patterns were needed in `Builder.shouldApplyImplicitLockingToUpdateInput`: ``` (Update $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $checks:* $mutationPrivate:* ) AND (Update $input:(Project $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $projections:* $passthrough:* ) $checks:* $mutationPrivate:* ) ``` These extra patterns are pushing the limits of this form of pattern matching, but this is ok for the next release. If/when we want to make any more general, we should strongly consider Andy's proposal to fold the patten matching and analysis into the explorer rather than execbuilder.
… join Fixes cockroachdb#45511. This commit enables implicit row-level locking on UPDATEs with an index-join in its initial row scan. To support this, two new patterns were needed in `Builder.shouldApplyImplicitLockingToUpdateInput`: ``` (Update $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $checks:* $mutationPrivate:* ) AND (Update $input:(Project $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $projections:* $passthrough:* ) $checks:* $mutationPrivate:* ) ``` These extra patterns are pushing the limits of this form of pattern matching, but this is ok for the next release. If/when we want to make any more general, we should strongly consider Andy's proposal to fold the patten matching and analysis into the explorer rather than execbuilder.
… join Fixes cockroachdb#45511. This commit enables implicit row-level locking on UPDATEs with an index-join in its initial row scan. To support this, two new patterns were needed in `Builder.shouldApplyImplicitLockingToUpdateInput`: ``` (Update $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $checks:* $mutationPrivate:* ) AND (Update $input:(Project $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $projections:* $passthrough:* ) $checks:* $mutationPrivate:* ) ``` These extra patterns are pushing the limits of this form of pattern matching, but this is ok for the next release. If/when we want to make any more general, we should strongly consider Andy's proposal to fold the patten matching and analysis into the explorer rather than execbuilder.
… join Fixes cockroachdb#45511. This commit enables implicit row-level locking on UPDATEs with an index-join in its initial row scan. To support this, two new patterns were needed in `Builder.shouldApplyImplicitLockingToUpdateInput`: ``` (Update $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $checks:* $mutationPrivate:* ) AND (Update $input:(Project $input:(IndexJoin $input:(Scan $scanPrivate:*) $indexJoinPrivate:* ) $projections:* $passthrough:* ) $checks:* $mutationPrivate:* ) ``` These extra patterns are pushing the limits of this form of pattern matching, but this is ok for the next release. If/when we want to make any more general, we should strongly consider Andy's proposal to fold the patten matching and analysis into the explorer rather than execbuilder.
We should be able to use implicit row-level locking on UPDATEs with an index-join in its initial row scan like the following, which perform no gateway-side filtering:
Currently, we only match on the following patterns:
cockroach/pkg/sql/opt/exec/execbuilder/mutation.go
Lines 793 to 812 in 9c72e72
The text was updated successfully, but these errors were encountered: