-
Neeraj Bisht authored
Problem:- When big_tables is enabled, COUNT DISTINCT on simple join with constant equality condition on non-duplicate key gives wrong result. Analysis:- In case of count distinct with sql_big_tables enable, we save our data in myisam file instead of heap unique tree. When we have a constant equality condition on non-duplicate key, we dont detect duplicate field values when inserting the records into the temporary table. Solution:- While creating temporary table, allow creations of fields for constant items. When we have distinct query, this will make sure the duplicate value filtered out when inserting rows in the temporary table. This fix may give a small overhead for queries that will create temporary table since columns for constant expressions may now be added to the temporary table. However, we do not think this overhead will be significant. If it is later found that it is necessary to reintroduce this optimization, it should be done by removing the field from the list of fields that are given to create_tmp_table().
Neeraj Bisht authoredProblem:- When big_tables is enabled, COUNT DISTINCT on simple join with constant equality condition on non-duplicate key gives wrong result. Analysis:- In case of count distinct with sql_big_tables enable, we save our data in myisam file instead of heap unique tree. When we have a constant equality condition on non-duplicate key, we dont detect duplicate field values when inserting the records into the temporary table. Solution:- While creating temporary table, allow creations of fields for constant items. When we have distinct query, this will make sure the duplicate value filtered out when inserting rows in the temporary table. This fix may give a small overhead for queries that will create temporary table since columns for constant expressions may now be added to the temporary table. However, we do not think this overhead will be significant. If it is later found that it is necessary to reintroduce this optimization, it should be done by removing the field from the list of fields that are given to create_tmp_table().
Loading