1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-30693: Assertion `dbl_records <= s->records' failed in apply_selectivity_for_table on SELECT

The crash happened due to rows=2 vs rows=1 difference between how the
estimate of number of rows in a derived table is computed in
TABLE_LIST::fetch_number_of_rows() and JOIN::add_keyuses_for_splitting().

Made JOIN::add_keyuses_for_splitting() use the result of computations in
TABLE_LIST::fetch_number_of_rows().
This commit is contained in:
Sergei Petrunia
2023-02-22 12:11:55 +03:00
parent 1310b3a02f
commit ef5bb0814a
3 changed files with 24 additions and 1 deletions

View File

@@ -741,7 +741,12 @@ void JOIN::add_keyuses_for_splitting()
if (ext_keyuses_for_splitting->push(keyuse_ext_end))
goto err;
spl_opt_info->unsplit_card= join_record_count;
/*
Use the number of rows that was computed by
TABLE_LIST::fetch_number_of_rows():
*/
spl_opt_info->unsplit_card=
rows2double(select_lex->master_unit()->derived->table->stat_records());
rec_len= table->s->rec_buff_length;