Data Access
Also available as:
PDF
loading table of contents...
Viewing Generated Statistics

Use the DESCRIBE statement to view statistics generated by CBO. Include the EXTENDED keyword if you want to include statistics gathered when the hive.stats.fetch.column.stats and hive.compute.query.using.stats properties are enabled.

  • Viewing Table Statistics

    • Use the following syntax to view table statistics:

      DESCRIBE [EXTENDED] table_name; 
      [Note]Note

      The EXTENDED keyword can be used only if the hive.stats.autogather property is enabled in the hive-site.xml configuration file.

    • The following example displays all statistics for the employees table:

      DESCRIBE EXTENDED employees; 
    • If the table statistics are up-to-date, the output includes the following table parameter information:

      {\"BASIC_STATS\":\"true\",\" ...
  • Viewing Column Statistics

    • Use the following syntax to view column statistics:

      DESCRIBE FORMATTED [db_name.]table_name.column_name; 
    • The following example displays statistics for the region column in the employees table:

      DESCRIBE FORMATTED employees.region; 
    • If the table statistics are up-to-date, the output includes the following table parameter information:

      COLUMN_STATS_ACCURATE 
[Note]Note

See Statistics in Hive on the Apache website for more information.