SpinTheMic
Pro

Interview practice question

Job writes thousands of tiny files

Data Engineering · Spark · Beginner

Your Spark job writes 5,000 files of about 50 KB each per day. Downstream queries are getting slow. How do you fix it?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Each task writes at least one file, so many partitions mean many files.
  • Small files slow down listing and reading.
  • Use coalesce or repartition before writing to target file sizes of around 128 MB to 1 GB.
  • Repartition by the partition column when using partitionBy.
  • Use table maintenance like OPTIMIZE or compaction for Delta and Iceberg.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics