Table Statistics in Apache Impala

Statistics about whole tables and partitions may be used by the Impala query planner. Physical characteristics such as the number of rows, the number of data files, the overall size of the data files, and the file type are included in this information. This post will show you how to retrieve and also how to update the table statistics.

Look at the below examples.

SHOW TABLE STATS empavro2;
Output:

#Rows#FilesSizeBytes CachedCache ReplicationFormatIncremental statsLocation
-111.30KBNot CachedNot CachedAVROFalsehdfs://quickstart.cloudera:8020/user/hive/warehouse/empavro2

SHOW TABLE STATS Employee_Parquet2;
Output:

#Rows#FilesSizeBytes CachedCache ReplicationFormatIncremental statsLocation
-11311BNot CachedNot CachedPARQUETFalsehdfs://quickstart.cloudera:8020/user/hive/warehouse/employee_parquet2

SHOW TABLE STATS townslist;
Output:

#Rows#FilesSizeBytes CachedCache ReplicationFormatIncremental statsLocation
-12105.22KBNot CachedNot CachedTEXTFalsehdfs://quickstart.cloudera:8020/user/hive/warehouse/townslist

Refer to the screenshot:

ShowTableStats
(Click on the image to zoom.)

The table statistics for an unpartitioned Parquet, avro and text file formatted tables are shown in the above example. The numbers for the number of files and their sizes are always accessible. Because a possibly costly scan of the full table is required to determine the number of rows, that value is initially shown as -1. The COMPUTE STATS command populates any missing table stats values.

Let’s update the statistics:

COMPUTE STATS empavro2;
COMPUTE STATS Employee_Parquet2;
COMPUTE STATS townslist;

ComputeStats_Impala

Hope you find this article useful.

Please subscribe for more interesting updates.

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s