Skip to content
  • Roy Lyseng's avatar
    74044f67
    Bug#14272788: Query with MaterializeScan and materialized subquery · 74044f67
    Roy Lyseng authored
                  returns too many rows
    
    Patch #12 - Clean up "materialized" state in JOIN_TAB vs TABLE_LIST.
    
    The patch is based on assuming that a materializable derived table
    that is determined to be const (contains maximum one row), is always
    materialized by the optimizer before activating the executor.
    A new functiom materializable_is_const() is implemented for
    materializable tables that determines whether this is the case, and
    the join_materialize_derived() function check whether such table
    is const before actually materializing it.
    
    sql/records.h
      Deleted unused fields copy_field and copy_field_end from READ_RECORD.
    
    sql/sql_derived.cc
      Eliminate use of TABLE_LIST::materialized. Instead use
      TABLE_LIST::materializable_is_const() to determine whether to
      materialize a derived table that is const.
    
    sql/sql_executor.cc
      In join_materialize_derived(), assume that a derived table that is
      denoted "const" is already materialized.
    
    sql/sql_optimizer.cc
      In get_quick_record_count(), use estimated rowcount for a derived table
      that is const. (However, this code is never invoked by the test suite).
    
    sql/table.cc
      Implement the function TABLE_LIST::TABLE_LIST::materializable_is_const().
      It should be called only for a materializable function 
      (uses_materialization() is TRUE), and it uses the row count estimate
      to determine whether the table is assumed to be const.
      In TABLE_LIST::fetch_number_of_rows(), safely use the estimated row count
      also for a materializable table that is const.
    
    sql/table.h
      Define function materializable_is_const(), and remove the "materialized"
      field from struct TABLE_LIST.
    74044f67
    Bug#14272788: Query with MaterializeScan and materialized subquery
    Roy Lyseng authored
                  returns too many rows
    
    Patch #12 - Clean up "materialized" state in JOIN_TAB vs TABLE_LIST.
    
    The patch is based on assuming that a materializable derived table
    that is determined to be const (contains maximum one row), is always
    materialized by the optimizer before activating the executor.
    A new functiom materializable_is_const() is implemented for
    materializable tables that determines whether this is the case, and
    the join_materialize_derived() function check whether such table
    is const before actually materializing it.
    
    sql/records.h
      Deleted unused fields copy_field and copy_field_end from READ_RECORD.
    
    sql/sql_derived.cc
      Eliminate use of TABLE_LIST::materialized. Instead use
      TABLE_LIST::materializable_is_const() to determine whether to
      materialize a derived table that is const.
    
    sql/sql_executor.cc
      In join_materialize_derived(), assume that a derived table that is
      denoted "const" is already materialized.
    
    sql/sql_optimizer.cc
      In get_quick_record_count(), use estimated rowcount for a derived table
      that is const. (However, this code is never invoked by the test suite).
    
    sql/table.cc
      Implement the function TABLE_LIST::TABLE_LIST::materializable_is_const().
      It should be called only for a materializable function 
      (uses_materialization() is TRUE), and it uses the row count estimate
      to determine whether the table is assumed to be const.
      In TABLE_LIST::fetch_number_of_rows(), safely use the estimated row count
      also for a materializable table that is const.
    
    sql/table.h
      Define function materializable_is_const(), and remove the "materialized"
      field from struct TABLE_LIST.
Loading