cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Small/big file problem, how do you fix it ?

William_Scardua
Valued Contributor

How do you work to fixing the small/big file problem ? what you suggest ?

1 ACCEPTED SOLUTION

Accepted Solutions

jose_gonzalez
Databricks Employee
Databricks Employee

Hi @William Scarduaโ€‹ ,

I will recommend to use Delta to avoid having small/big files issues. For example, Auto Optimize is an optional set of features that automatically compact small files during individual writes to a Delta table. Paying a small cost during writes offers significant benefits for tables that are queried actively. For more details and examples please check the following link

Auto optimize will create files of 128 MB each. If you would like to compress and optimize further, then I will recommend to use "Optimize" command on your Delta tables. It will compress and create files of 1 GB in size, by default. For more details on this optimize feature, please check the following link

Thank you.

View solution in original post

4 REPLIES 4

jose_gonzalez
Databricks Employee
Databricks Employee

Hi @William Scarduaโ€‹ ,

I will recommend to use Delta to avoid having small/big files issues. For example, Auto Optimize is an optional set of features that automatically compact small files during individual writes to a Delta table. Paying a small cost during writes offers significant benefits for tables that are queried actively. For more details and examples please check the following link

Auto optimize will create files of 128 MB each. If you would like to compress and optimize further, then I will recommend to use "Optimize" command on your Delta tables. It will compress and create files of 1 GB in size, by default. For more details on this optimize feature, please check the following link

Thank you.

Okay @Jose Gonzalezโ€‹ , I understand .. thank you man

-werners-
Esteemed Contributor III

What Jose said.

If you cannot use delta or do not want to:

the use of coalesce and repartition/partitioning is the way to define the file size.

There is no one ideal file size. It all depends on the use case, available cluster size, data flow downstream etc.

What you do want to avoid is a lot of small files (think only a few megabytes or kilobytes).

But there is nothing wrong with a single file of 2 MB.

That being said: delta lake makes this exercise way easier.

thank you for feedback @Werner Stinckensโ€‹ , that`s a good point

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group