Skip to content
  • Gopal Shankar's avatar
    f4442838
    WL#9814 Implement INFORMATION_SCHEMA system views for FILES/PARTITIONS · f4442838
    Gopal Shankar authored
    This patch implements I_S.PARTITIONS as a system view over data
    dictionary tables, and remove 5.7 code that uses a temporary
    table to represent I_S view.
    
    Following changes are made in the patch:
    
    * Define a system view over data dictionary tables representing
      I_S.PARTITIONS.
    
    * Add following new dictionary columns to store utf8 string version.
    
      mysql.table_partitions.description_utf8 representing
      I_S.PARTITIONS.DESCRIPTION
    
      mysql.tables.subpartition_expression_utf8 representing
      I_S.PARTITIONS.SUBPARTITION_EXPRESSION
    
      mysql.tables.partition_expression_utf8 representing
      I_S.PARTITIONS.PARTITION_EXPRESSION
    
    * Make dd::info_schema::Statistics_cache implementation to
      consider not just schema_name and table_name for cache key, but
      also include partition name. This is required now because we
      now cache per partition dynamic statistics with this WL.
    
    * Make dd::info_schema::Statistics_cache implementation to cache
      the table checksum value. This value is computed only for
      partitions.
    
    * Make implementation of Statistics_cache::read_stat_by_open_table()
      to fetch per partition dynamic table statistics.
    
    * If a partition is not found when fetching dynamic table
      statistics, then we will report a warning and continue
      processing new rows.  This might happen when I_S system view
      execution starts and later the partition table is ALTERed. A
      test case parts.partition_debug_sync_innodb is updated to cover
      this scenario.
    
    * Change definition of internal sql functions to accept partition
      name.This is used to calculate the per partition statistics.
    
      We currently read the statistics for partitioned table by
      opening the table. We can probably improve the performance for
      InnoDB partitioned tables, by calling SE api's that read just
      the statistics. This is not done as of now.
    
    * Introduce internal sql function
      INTERNAL_GET_PARTITION_NODEGROUP() to fetch
      I_S.PARTITIONS.NODEGROUP value from
      mysql.table_partitions.options.
    
    * There is no consumer of function expr_to_string() requesting
      the string in hex form. So, the patch modifies it to return
      only string.
    
    * Remove 5.7 code from sql_show.cc for I_S.PARTITIONS.
    
    * Added ORDER BY clauses in some of I_S query to force order of
      tuple returned. Because, now the optimizer returns the rows and
      not read from temporary table as in 5.7 I_S design.
    
    * Remove part of test case in main.information_schema. Because,
    
      - The problem reported back then is only applicable for 5.7
        code.
    
      - The output of EXPLAIN ... <select on I_S system view> goes
        through optimizer and then plan return might vary.
    
    * We now show 1024 character of partition comment string, unlike just 80
      characters shown in 5.7 by I_S.
    f4442838
    WL#9814 Implement INFORMATION_SCHEMA system views for FILES/PARTITIONS
    Gopal Shankar authored
    This patch implements I_S.PARTITIONS as a system view over data
    dictionary tables, and remove 5.7 code that uses a temporary
    table to represent I_S view.
    
    Following changes are made in the patch:
    
    * Define a system view over data dictionary tables representing
      I_S.PARTITIONS.
    
    * Add following new dictionary columns to store utf8 string version.
    
      mysql.table_partitions.description_utf8 representing
      I_S.PARTITIONS.DESCRIPTION
    
      mysql.tables.subpartition_expression_utf8 representing
      I_S.PARTITIONS.SUBPARTITION_EXPRESSION
    
      mysql.tables.partition_expression_utf8 representing
      I_S.PARTITIONS.PARTITION_EXPRESSION
    
    * Make dd::info_schema::Statistics_cache implementation to
      consider not just schema_name and table_name for cache key, but
      also include partition name. This is required now because we
      now cache per partition dynamic statistics with this WL.
    
    * Make dd::info_schema::Statistics_cache implementation to cache
      the table checksum value. This value is computed only for
      partitions.
    
    * Make implementation of Statistics_cache::read_stat_by_open_table()
      to fetch per partition dynamic table statistics.
    
    * If a partition is not found when fetching dynamic table
      statistics, then we will report a warning and continue
      processing new rows.  This might happen when I_S system view
      execution starts and later the partition table is ALTERed. A
      test case parts.partition_debug_sync_innodb is updated to cover
      this scenario.
    
    * Change definition of internal sql functions to accept partition
      name.This is used to calculate the per partition statistics.
    
      We currently read the statistics for partitioned table by
      opening the table. We can probably improve the performance for
      InnoDB partitioned tables, by calling SE api's that read just
      the statistics. This is not done as of now.
    
    * Introduce internal sql function
      INTERNAL_GET_PARTITION_NODEGROUP() to fetch
      I_S.PARTITIONS.NODEGROUP value from
      mysql.table_partitions.options.
    
    * There is no consumer of function expr_to_string() requesting
      the string in hex form. So, the patch modifies it to return
      only string.
    
    * Remove 5.7 code from sql_show.cc for I_S.PARTITIONS.
    
    * Added ORDER BY clauses in some of I_S query to force order of
      tuple returned. Because, now the optimizer returns the rows and
      not read from temporary table as in 5.7 I_S design.
    
    * Remove part of test case in main.information_schema. Because,
    
      - The problem reported back then is only applicable for 5.7
        code.
    
      - The output of EXPLAIN ... <select on I_S system view> goes
        through optimizer and then plan return might vary.
    
    * We now show 1024 character of partition comment string, unlike just 80
      characters shown in 5.7 by I_S.
Loading