In 5.1.19 binary crashes: -------------------------- mysqld.exe!greedy_search(JOIN * join=0x03740c00, unsigned __int64 remaining_tables=0x000000ffffffff80, unsigned int search_depth=0x00000007, unsigned int prune_level=0x00000001) Line 4745 + 0x6 bytes C++ mysqld.exe!choose_plan(JOIN * join=0x00000000, unsigned __int64 join_tables=0x000000ffffffffff) Line 4445 + 0x16 bytes C++ mysqld.exe!make_join_statistics(JOIN * join=0x00000000, st_table_list * tables=0x00000000, Item * conds=0x0b738b30, st_dynamic_array * keyuse_array=0x03741d18) Line 2754 C++ mysqld.exe!JOIN::optimize() Line 910 + 0x22 bytes C++ mysqld.exe!mysql_select(THD * thd=0x036e82d0, Item * * * rref_pointer_array=0x036e9448, st_table_list * tables=0x0b6f31d8, unsigned int wild_num=0x00000001, List & fields={...}, Item * conds=0x0b738b30, unsigned int og_num=0x00000000, st_order * order=0x00000000, st_order * group=0x00000000, Item * having=0x00000000, st_order * proc_param=0x00000000, unsigned __int64 select_options=0x0000000080044a04, select_result * result=0x0b738ce0, st_select_lex_unit * unit=0x036e90b8, st_select_lex * select_lex=0x03740c00) Line 2244 + 0x7 bytes C++ mysqld.exe!mysql_explain_union(THD * thd=0x036e82d0, st_select_lex_unit * unit=0x036e90b8, select_result * result=0x0b738ce0) Line 15618 + 0x6d bytes C++ mysqld.exe!execute_sqlcom_select(THD * thd=0x00000000, st_table_list * all_tables=0x00000000) Line 4425 + 0xe bytes C++ mysqld.exe!mysql_execute_command(THD * thd=0x036e82d0) Line 1843 + 0xb bytes C++ mysqld.exe!strmake_root(st_mem_root * root=0x0b738a38, const char * str=0x00437934, unsigned int len=0x0b738910) Line 407 + 0xc bytes C mysqld.exe!Item_func::Item_func(Item * a=0x0b67efb8, Item * b=0x036e82d0) Line 78 C++ mysqld.exe!MYSQLparse(void * yythd=0x036e82d0) Line 14618 + 0xb bytes C++ mysqld.exe!mysql_parse(THD * thd=0x036e82d0, const char * inBuf=0x0b6f2ec8, unsigned int length=0x0000020b, const char * * found_semicolon=0x0b67f830) Line 5356 C++ mysqld.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x036e82d0, char * packet=0x0b9d8ea9, unsigned int packet_length=0x0000020c) Line 908 C++ mysqld.exe!do_command(THD * thd=0x0000020c) Line 667 + 0x10 bytes C++ mysqld.exe!handle_one_connection(void * arg=0x036e82d0) Line 1091 + 0xa bytes C++ mysqld.exe!pthread_start(void * param=0x0b9a4f98) Line 62 + 0x3 bytes C mysqld.exe!_callthreadstart() Line 293 + 0x6 bytes C mysqld.exe!_threadstart(void * ptd=0x0b81e600) Line 275 + 0x5 bytes C kernel32.dll!FlsSetValue() + 0x136 bytes DBUG_ASSERT((pos != NULL)); // should always find 'best_table' <----------crash debug /* move 'best_table' at the first free position in the array of joins */ swap_variables(JOIN_TAB*, join->best_ref[idx], join->best_ref[best_idx]); /* compute the cost of the new plan extended with 'best_table' */ record_count*= join->positions[idx].records_read; read_time+= join->positions[idx].read_time; remaining_tables&= ~(best_table->table->map); <-------------crash release --size_remain; ++idx;