Bug #118056 optimzie for alter index
Submitted: 25 Apr 9:14 Modified: 25 Apr 9:25
Reporter: alex xing (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S5 (Performance)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[25 Apr 9:14] alex xing
Description:
For the alter index, in fill_alter_inplace_info, you can first check new_key before initializing table_key to avoid unnecessary overhead.

How to repeat:
just read the code

Suggested fix:
just as the below patch
[25 Apr 9:15] alex xing
a simple patch to describe the optimization

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

Contribution: alter_index_optimize.patch (application/octet-stream, text), 960 bytes.

[25 Apr 9:21] alex xing
In the native logic, if the new_key does not exist, find_key_ci is executed and traversing all indexes. 
After optimization, this unnecessary traversal is no longer needed.
[25 Apr 9:25] MySQL Verification Team
Hello Alex Xing,

Thank you for the report and contribution.

regards,
umesh