• Mattias Jonsson's avatar
    Bug#53806: Wrong estimates for range query in partitioned MyISAM table · e5bab33a
    Mattias Jonsson authored
    Bug#46754: 'rows' field doesn't reflect partition pruning
    
    The EXPLAIN's result in 'rows' field
    was evaluated to number of rows when the table was opened
    (not from the table cache) and only the partitions left
    after pruning was updated with its correct number
    of rows.
    
    The evaluation of the 'rows' field was using handler::records()
    which is a potentially expensive call, and ignores the partitioning
    pruning.
    
    The fix was to use the handlers stats.records after updating it
    with ::info(HA_STATUS_VARIABLE) instead.
    
    mysql-test/r/partition_pruning.result:
      updated result
    mysql-test/t/partition_pruning.test:
      Added test.
    sql/sql_select.cc:
      Use ::info + stats.records instead of ::records().
    e5bab33a
partition_pruning.result 138 KB