1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

BUG#17379 Wrong reuse of E(#rows(range)) as E(#rows(ref(const))):

Re-work best_access_path() and find_best() to reuse E(#rows(range access)) as
E(#rows(ref[_or_null](const) access) only when it is appropriate.
[This is the final cumulative patch]
This commit is contained in:
sergefp@mysql.com
2006-05-10 17:40:20 +04:00
parent 1efda1ea54
commit 2956dbe84f
6 changed files with 154 additions and 24 deletions

View File

@ -347,8 +347,10 @@ typedef struct st_qsel_param {
uint *imerge_cost_buff; /* buffer for index_merge cost estimates */
uint imerge_cost_buff_size; /* size of the buffer */
/* TRUE if last checked tree->key can be used for ROR-scan */
/* TRUE if last checked tree->key can be used for ROR-scan */
bool is_ror_scan;
/* Number of ranges in the last checked tree->key */
uint n_ranges;
} PARAM;
class TABLE_READ_PLAN;
@ -5297,6 +5299,7 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree)
param->table->file->primary_key_is_clustered());
param->is_ror_scan= !cpk_scan;
}
param->n_ranges= 0;
records=check_quick_keys(param,idx,tree,param->min_key,0,param->max_key,0);
if (records != HA_POS_ERROR)
@ -5304,7 +5307,7 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree)
param->table->quick_keys.set_bit(key);
param->table->quick_rows[key]=records;
param->table->quick_key_parts[key]=param->max_key_part+1;
param->table->quick_n_ranges[key]= param->n_ranges;
if (cpk_scan)
param->is_ror_scan= TRUE;
}
@ -5440,7 +5443,10 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
HA_NOSAME &&
min_key_length == max_key_length &&
!memcmp(param->min_key,param->max_key,min_key_length))
{
tmp=1; // Max one record
param->n_ranges++;
}
else
{
if (param->is_ror_scan)
@ -5460,6 +5466,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
is_key_scan_ror(param, keynr, key_tree->part + 1)))
param->is_ror_scan= FALSE;
}
param->n_ranges++;
if (tmp_min_flag & GEOM_FLAG)
{