Feature Request: UPDATE with JOINs with all the same vindexes does not need OperatorType DMLWithInput #16876
Labels
Component: Query Serving
Type: Enhancement
Logical improvement (somewhere between a bug and feature)
Overview of the Issue
Vitess recently got UPDATE with JOIN support, but there may be some inefficiency/deficiency. It seems to resort to OperatorType
DMLWithInput
(which rewrites toSELECT ... FOR UPDATE; UPDATE ...
) when it doesn't have to. This is not only inefficient, but also, when does that rewrite, it causes deadlocks if you have multiple connections doing it an the same time (in transactions). I ran into this.Expected result: when using fields from joined tables from the same shard/vindex in the
SET
expression, it can still use OperatorTypeUpdate
.Reproduction Steps
As an example that is treated well: I use hard-coded values in
SET
, it uses a normal update:But when I take the value to set from the
JOIN
, it usesDMLWithInput
:The relevant table entries in the VSchema:
And:
Binary Version
vtgate version Version: 20.0.2 (Git revision 2592c5932b3036647868299b6df76f8ef28dfbc8 branch 'HEAD') built on Wed Sep 11 08:15:20 UTC 2024 by runner@fv-az1152-369 using go1.22.7 linux/amd64
Operating System and Environment details
cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=24.04 DISTRIB_CODENAME=noble DISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"
Log Fragments
No response
The text was updated successfully, but these errors were encountered: