Bug #118072 Optimize DDL operations involving AUTO_INCREMENT columns
Submitted: 28 Apr 14:10 Modified: 28 Apr 14:24
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

[28 Apr 14:10] alex xing
Description:
Problem:
When an invalid AUTO_INCREMENT column is specified in a CREATE TABLE or ALTER TABLE statement, MySQL currently proceeds with DDL preparations—such as key list traversal, duplicate key checks (dup_check_key), and invisible index validation.

Solution:
Introduce an early check for AUTO_INCREMENT column  in mysql_prepare_create_table() . If invalid, the operation fails immediately, skipping:

Traversal of alter_info->key_list

Redundant dup_check_key verification

Invisible index correctness checks

How to repeat:
just read the code

Suggested fix:
optimize as the below patch
[28 Apr 14:10] 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: mysql_prepare_create_table_optimize.patch (application/octet-stream, text), 1018 bytes.

[28 Apr 14:24] MySQL Verification Team
Hello Alex Xing,

Thank you for the report and contribution.

regards,
umesh