Bug #119094 Performance optimization patches
Submitted: 29 Sep 2025 13:03 Modified: 12 Dec 2025 13:38
Reporter: Kamil Holubicki (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[29 Sep 2025 13:03] Kamil Holubicki
Description:
Based on work published on https://github.com/enhancedformysql/mysql-8.0.40 by Bin Wang, Percona identified several fixes that we applied to Percona Server and hope can be incorporated in MySQL. All patches attached.

1. mem_root_deque implementation using std::list
2. Inlining hot-spot InnoDB functions
3. Revert refactoring that extracted rec_init_offset_new() function. (8.0.29, commit e8f422de).
We have found that even if a new function is declared as 'inline', the compiler doesn't decide to do so. Moreover, the introduced switch/case introduces an additional conditional jump in the generated assembly code.
4. Fix for refactoring done in commit 43e364c3 (const tables handling by optimizer).
If the optimizer detected the const table in the query, this information is not passed to test_quick_select() and may result in nonoptimal range scan boundaries.

How to repeat:
.
[29 Sep 2025 13:04] Kamil Holubicki
const tables patch

Attachment: const_tables.patch (text/x-patch), 2.75 KiB.

[29 Sep 2025 13:04] Kamil Holubicki
rec_init_offset_new patch

Attachment: rec_init_offset_new.patch (text/x-patch), 7.26 KiB.

[29 Sep 2025 13:05] Kamil Holubicki
const tables patch

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: const_tables.patch (text/x-patch), 2.75 KiB.

[29 Sep 2025 13:05] Kamil Holubicki
rec_init_offset_new patch

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: rec_init_offset_new.patch (text/x-patch), 7.26 KiB.

[29 Sep 2025 13:05] Kamil Holubicki
inline patch

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: inline.patch (text/x-patch), 21.68 KiB.

[29 Sep 2025 13:13] Kamil Holubicki
I'm not able to add a patch for deque part. When submitting, I see the server error.
I will retry again later. 

Commits are available here:
https://github.com/percona/percona-server/commit/a45db1eb1aaa7486879cf4c360dfd5f70f445ff2
https://github.com/percona/percona-server/commit/bc0ec11d952a32afd9e2d6cdb4b6333fd9484114
[7 Oct 2025 0:54] MySQL Verification Team
Thank you for your contribution.
[12 Dec 2025 13:38] Øystein Grøvlen
Thank you for your contributions. 

It would be great to if we could have some more details on the rationale for each of the patches.

Also, for future contributions, please, use different bug reports for Optimizer and InnoDB patches.  That will simplify the handling on our side.