1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Added 'records_out' and join_type to POSITION

records_out is the numbers of rows expected to be accepted from a table.
records_read is in contrast the number of rows that the optimizer excepts
to read from the engine.

This patch causes not plan changes. The differences in test results comes
from renaming "records" to "records_read" and printing of record_out in
the optimizer trace.

Other things:
- Renamed table_cond_selectivity() to table_after_join_selectivity()
  to make the purpose of the function more clear.
This commit is contained in:
Monty
2022-04-11 17:59:36 +03:00
committed by Sergei Petrunia
parent 9db877c9ec
commit 2387ee9b45
13 changed files with 1192 additions and 198 deletions

View File

@ -343,7 +343,10 @@ typedef struct st_join_table {
/* Copy of POSITION::records_read, set by get_best_combination() */
double records_read;
/* Copy of POSITION::records_out, set by get_best_combination() */
double records_out;
/* The selectivity of the conditions that can be pushed to the table */
double cond_selectivity;
@ -938,12 +941,23 @@ public:
/* The table that's put into join order */
JOIN_TAB *table;
/*
The number of rows that will be read from the table
*/
double records_read;
/*
The "fanout": number of output rows that will be produced (after
pushed down selection condition is applied) per each row combination of
previous tables.
This takes into account table->cond_selectivity, the WHERE clause
related to this table calculated in
calculate_cond_selectivity_for_table(), and the used rowid filter but
does not take into account the WHERE clause involving preceding tables
calculated in table_after_join_selectivity().
*/
double records_read;
double records_out;
/* The selectivity of the pushed down conditions */
double cond_selectivity;
@ -1007,6 +1021,7 @@ public:
/* Type of join (EQ_REF, REF etc) */
enum join_type type;
/*
Valid only after fix_semijoin_strategies_for_picked_join_order() call:
if sj_strategy!=SJ_OPT_NONE, this is the number of subsequent tables that