• Annamalai Gurusami's avatar
    Bug #14200010 NEWLY CREATED TABLE DOESN'T ALLOW FOR LOOSE INDEX SCANS · d426504b
    Annamalai Gurusami authored
    Problem:
    
    Before the ALTER TABLE statement, the array
    dict_index_t::stat_n_diff_key_vals had proper values calculated
    and updated.  But after the ALTER TABLE statement, all the values
    of this array is 0.  
    
    Because of this statistics returned by innodb_rec_per_key() is
    different before and after the ALTER TABLE statement. Running the
    ANALYZE TABLE command populates the statistics correctly.
    
    Solution:
    
    After ALTER TABLE statement, set the flag dict_table_t::stat_initialized
    correctly so that the table statistics will be recalculated properly when
    the table is next loaded.  But note that we still don't choose the loose
    index scans.  This fix only ensures that an ALTER TABLE does not change
    the optimizer plan.
    
    rb://1639 approved by Marko and Jimmy.
    d426504b
innodb_mysql.result 67.2 KB