Skip to content

Commit b3a4a6a

Browse files
percona-mhanssoninikep
authored andcommitted
PS-10232 [9.x]: MySQL 8.0.40+ is about 2-3x times slower than 8.0.39 in
particular index scan scenario A follow up fix for "Bug#36775910: Record buffer not set in index range scans" [2969af5] caused a performance regression by failing to respect the handler's recommendation to cap the number of rows in the record buffer (at the time of writing hard-coded to 100 for InnoDB). This caused a performance regression which is most pronounced when using a small LIMIT. Fixed by re-introducing the line implementing cap.
1 parent e04d1e2 commit b3a4a6a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sql/sql_executor.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@ bool set_record_buffer(TABLE *table, double expected_rows_to_fetch) {
769769
}
770770
}
771771

772+
// Do not allocate space for more rows than the handler asked for.
773+
rows_in_buffer = std::min(rows_in_buffer, max_rows);
774+
772775
// After adjustments made above, we still need a minimum of 2 rows to
773776
// use a record buffer.
774777
if (rows_in_buffer <= 1) {

0 commit comments

Comments
 (0)