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

sql/opt: implicit SFU locking on Update's row fetch disabled with locality-optimized search #92847

Open
nvanbenschoten opened this issue Dec 1, 2022 · 2 comments
Labels
A-sql-optimizer SQL logical planning and optimizations. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) E-quick-win Likely to be a quick win for someone experienced. T-sql-queries SQL Queries Team
Projects

Comments

@nvanbenschoten
Copy link
Member

nvanbenschoten commented Dec 1, 2022

Consider a YCSB usertable that's configured as REGIONAL BY ROW. An update statement on this table looks like:

UPDATE usertable SET field9 = $1 WHERE ycsb_key = $1

Today, this UPDATE has a plan that looks like:

• update
│ table: usertable
│ set
│ auto commit
│
└── • render
    │
    └── • union all
        │
        ├── • scan
        │     table: usertable@usertable_pkey
        │     spans: 1+ spans
        │
        └── • scan
              table: usertable@usertable_pkey
              spans: 1+ spans

Notice that the initial row fetch of the UPDATE uses locality-optimized search. That's good!

However, notice also that SFU locking is not pushed into the scans. That's because the pattern matching in shouldApplyImplicitLockingToUpdateInput which we use to power implicit SFU for UPDATES does not properly handle locality-optimized search. We should be pushing the SFU locking into each branch of the locality-optimized search.

Jira issue: CRDB-22000

Epic CRDB-25322

@nvanbenschoten nvanbenschoten added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-sql-optimizer SQL logical planning and optimizations. T-sql-queries SQL Queries Team labels Dec 1, 2022
@nvanbenschoten nvanbenschoten added this to Triage in SQL Queries via automation Dec 1, 2022
@msirek msirek moved this from Triage to 23.1 Release in SQL Queries Dec 6, 2022
@mgartner mgartner added the E-quick-win Likely to be a quick win for someone experienced. label Dec 8, 2022
@mgartner mgartner moved this from 23.1 Release to 23.2 Release in SQL Queries Jan 5, 2023
@mgartner
Copy link
Collaborator

@michae2 will this be a priority for 24.2?

@michae2
Copy link
Collaborator

michae2 commented Mar 28, 2024

It would be nice but probably not a priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-optimizer SQL logical planning and optimizations. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) E-quick-win Likely to be a quick win for someone experienced. T-sql-queries SQL Queries Team
Projects
Status: New Backlog
SQL Queries
23.2 Release
Development

No branches or pull requests

3 participants