cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

how to check table size by partition?

tototox
New Contributor III

I want to check the size of the delta table by partition.

As you can see, only the size of the table can be checked, but not by partition.

3 REPLIES 3

Anonymous
Not applicable

@jin park​ :

You can use the Databricks Delta Lake SHOW TABLE EXTENDED command to get the size of each partition of the table. Here's an example:

%sql
SHOW TABLE EXTENDED LIKE '<table_name>' 
PARTITION (<partition_column> = '<partition_value>') 
SELECT sizeInBytes

Replace <table_name> with the name of your Delta table, <partition_column> with the name of your partition column, and <partition_value> with the specific partition value you want to check the size for. If you want to check the size for all partitions, omit the PARTITION clause.

You can also use the DESCRIBE DETAIL command to get similar information:

%sql
DESCRIBE DETAIL <table_name>

This will show you detailed information about the table, including the size of each partition.

tototox
New Contributor III

There is no 'sizeInbytes' item.

Anonymous
Not applicable

@jin park​ : Please try this

DESCRIBE DETAIL your_table_name PARTITION (partition_column = 'partition_value')

Replace 'your_table_name' with the actual name of your table and specify the appropriate partition_column and partition_value you want to check.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.