Bug #93827 dict_index_has_desc() is not efficient
Submitted: 7 Jan 2019 4:45 Modified: 8 Jan 2019 13:35
Reporter: zhai weixiang (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[7 Jan 2019 4:45] zhai weixiang
Description:
In function dict_index_has_desc, it will check user defined columns on index until it found a desc column. and will check all if there's no descending column. This is not efficient (especailly when change buffer is frequently used) ,  actually we don't need to check it every time because the attribute is only changed when modifying index... 

How to repeat:
Read the code 

Suggested fix:
Add a flag to dict_index_t which indicates if it's descending index, and update it while loading index or altering index.
[8 Jan 2019 13:35] MySQL Verification Team
Hi,

I actually fully agree with your analysis and find that this is a useful performance bug.

Verified as reported.