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

Code cleanup

Fixed bug in optimizer where it didn't choose right table order in some cases


myisam/mi_delete.c:
  Remove not needed include errno.h
myisam/mi_delete_table.c:
  Remove not needed include errno.h
myisam/mi_extra.c:
  Remove not needed include errno.h
myisam/mi_locking.c:
  Remove not needed include errno.h
myisam/mi_log.c:
  Remove not needed include errno.h
myisam/mi_page.c:
  Remove not needed include errno.h
myisam/mi_rename.c:
  Remove not needed include errno.h
myisam/mi_update.c:
  Remove not needed include errno.h
myisam/mi_write.c:
  Remove not needed include errno.h
mysql-test/r/subselect.result:
  Update of test after optimzier fix
mysys/charset.c:
  Code cleanup
sql/item_cmpfunc.cc:
  Removed not needed comment
  Indentation cleanup
sql/item_cmpfunc.h:
  Indentation cleanup
sql/mysqld.cc:
  Updated comment for expire_logs_days
sql/set_var.cc:
  Remved duplicate code
sql/sql_select.cc:
  Fixed bug in optimizer where it didn't choose right table order in some cases (Bug found and fixed by Igor)
This commit is contained in:
unknown
2004-01-19 23:51:17 +01:00
parent 21bef0ed8c
commit 43abc597b8
16 changed files with 34 additions and 66 deletions

View File

@ -2688,22 +2688,35 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
do
{
uint keypart=keyuse->keypart;
uint found_part_ref_or_null= KEY_OPTIMIZE_REF_OR_NULL;
table_map best_part_found_ref= 0;
double best_prev_record_reads= DBL_MAX;
do
{
if (!(rest_tables & keyuse->used_tables) &&
!(found_ref_or_null & keyuse->optimize))
{
found_part|=keyuse->keypart_map;
found_ref|= keyuse->used_tables;
double tmp= prev_record_reads(join,
(found_ref |
keyuse->used_tables));
if (tmp < best_prev_record_reads)
{
best_part_found_ref= keyuse->used_tables;
best_prev_record_reads= tmp;
}
if (rec > keyuse->ref_table_rows)
rec= keyuse->ref_table_rows;
found_part_ref_or_null&= keyuse->optimize;
/*
If there is one 'key_column IS NULL' expression, we can
use this ref_or_null optimsation of this field
*/
found_ref_or_null|= (keyuse->optimize &
KEY_OPTIMIZE_REF_OR_NULL);
}
keyuse++;
found_ref_or_null|= found_part_ref_or_null;
} while (keyuse->table == table && keyuse->key == key &&
keyuse->keypart == keypart);
found_ref|= best_part_found_ref;
} while (keyuse->table == table && keyuse->key == key);
/*