[MDEV-30078] SQL Layer support for: Use fewer InnoDB mini-transactions Created: 2022-11-23 Updated: 2023-12-22 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Fix Version/s: | 11.5 |
| Type: | New Feature | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Oleg Smirnov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
in MDEV-16232, InnoDB is implementing an optimization to cut down on latch acquisitions/releases and other kinds of overhead when the query is about to perform multiple operations on the [index] records on the same page. In the Storage engine API, this translates into the following calls:
InnoDB will hold internal page latches (and something else?) between calls (1) and (2),
ApplicabilityThe mini-transaction calls can be put around all loops where we call 'read next' repeatedly for just one table. The places in the select/filesort code where this happens:
Batching cannot be used if one of the following holds:
Where to put the batching callsStep #1Single-Table UPDATE and DELETE that satisfy the Applicability criteria should execute the whole query in one batch. This means we will add just two
onto the main execution path. The prototype patchThe prototype patch is in this branch: 10.9-MDEV-16232, this commit:
It implements the check for UPDATE and DELETE. It doesn't have the applicability check (it has some hack). Or mysql-test coverage. Because of that it can cause crashes: The prototype patch has some hack to handle single-table selects. Step #2A multi-table select may use batches for the last table in the join. Access to the last table must satisfy the Applicability criteria. Can we avoid calling "if (table does batching)" for every row examined for any table? Note: the prototype patch doesn't handle this at all. VisibilityNeed some way to see if the optimization is applied. This is probably a too fine detail to show in EXPLAIN output. We should also write about the decision whether batching is to be used into the optimizer trace. User ControlIt's a good idea to be able to switch the optimization on and off. Error handling
|