Bug #119088 sort with limit in hypergraph gets wrong result

Submitted: 28 Sep 2025 6:31 Modified: 31 Mar 16:32
Reporter: Malt Chen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:9.2,9.4 OS:Any
Assigned to: CPU Architecture:Any

[28 Sep 2025 6:31] Malt Chen
Description:
I got the wrong result when 'order by limit' in hypergraph.

When creating table use 'utf8mb4_general_ci' character, it will happen. The result lost the 'limit' and get redundant data.

How to repeat:
set sql_mode = '';
CREATE TABLE `t1` (
  `a` char(0) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
insert into t1 values(0),(0);

# In hypergraph, it will get 2 rows, 'limit 1' does not effective
set optimizer_switch='hypergraph_optimizer=on';
select * from t1 order by a limit 1;

# In non-hypergraph, an extra limit AccessPath on Sort AccessPath, it will get 1 row, result is ok.
set optimizer_switch='hypergraph_optimizer=off';
select * from t1 order by a limit 1;
[15 Dec 2025 11:04] Øystein Grøvlen
Thank you for your report. Verified as described.
[31 Mar 16:32] Edward Gilmore
Posted by developer:
 
No documentation required.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.