mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Bug#53806: Wrong estimates for range query in partitioned MyISAM table
Bug#46754: 'rows' field doesn't reflect partition pruning The EXPLAIN's result in 'rows' field was evaluated to number of rows when the table was opened (not from the table cache) and only the partitions left after pruning was updated with its correct number of rows. The evaluation of the 'rows' field was using handler::records() which is a potentially expensive call, and ignores the partitioning pruning. The fix was to use the handlers stats.records after updating it with ::info(HA_STATUS_VARIABLE) instead.
This commit is contained in:
@@ -16640,7 +16640,15 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
|
||||
if (tab->select && tab->select->quick)
|
||||
examined_rows= tab->select->quick->records;
|
||||
else if (tab->type == JT_NEXT || tab->type == JT_ALL)
|
||||
examined_rows= tab->limit ? tab->limit : tab->table->file->records();
|
||||
{
|
||||
if (tab->limit)
|
||||
examined_rows= tab->limit;
|
||||
else
|
||||
{
|
||||
tab->table->file->info(HA_STATUS_VARIABLE);
|
||||
examined_rows= tab->table->file->stats.records;
|
||||
}
|
||||
}
|
||||
else
|
||||
examined_rows=(ha_rows)join->best_positions[i].records_read;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user