Search code examples
impalapartition

How can I see the number of partitions in an impala table


Is it possible to see the total number of partitions of a table in impala?

For example db.table has 40.500 partitions


Solution

  • Use SHOW PARTITIONS statement.

    SHOW PARTITIONS [database_name.]table_name
    

    It will print partition list and you can count rows in the output minus header(3 rows) and footer(1 row). Unfortunately, there is no command which can return partition count already calculated except for Kudu tables: SHOW TABLE STATS prints the # of partitions in Kudu table.

    Of course you can execute select count(distinct part_col1, part_col2...) from table, but it is not as efficient as SHOW partitions