cheat when all parts of count(distinct) key are binary
This commit is contained in:
parent
6ecaac01f0
commit
196e995caf
@ -926,15 +926,26 @@ bool Item_sum_count_distinct::setup(THD *thd)
|
|||||||
}
|
}
|
||||||
else // too bad, cannot cheat - there is more than one field
|
else // too bad, cannot cheat - there is more than one field
|
||||||
{
|
{
|
||||||
cmp_arg = (void*)this;
|
bool all_binary = 1;
|
||||||
compare_key = (qsort_cmp2)composite_key_cmp;
|
|
||||||
Field** field, **field_end;
|
Field** field, **field_end;
|
||||||
field_end = (field = table->field) + table->fields;
|
field_end = (field = table->field) + table->fields;
|
||||||
for(key_len = 0; field < field_end; ++field)
|
for(key_len = 0; field < field_end; ++field)
|
||||||
{
|
{
|
||||||
key_len += (*field)->field_length;
|
key_len += (*field)->field_length;
|
||||||
|
if(!(*field)->binary())
|
||||||
|
all_binary = 0;
|
||||||
}
|
}
|
||||||
rec_offset = table->reclength - key_len;
|
rec_offset = table->reclength - key_len;
|
||||||
|
if(all_binary)
|
||||||
|
{
|
||||||
|
compare_key = (qsort_cmp2)simple_raw_key_cmp;
|
||||||
|
cmp_arg = (void*)key_len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
compare_key = (qsort_cmp2)composite_key_cmp ;
|
||||||
|
cmp_arg = (void*)this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init_tree(&tree, min(max_heap_table_size, sortbuff_size/16),
|
init_tree(&tree, min(max_heap_table_size, sortbuff_size/16),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user