Parqet vs Delta if I always overwrite data

Viewed 296

Which format better to use if I just overwrite data always?

When I overwrite data as Delta I notice that the folder size increases (I think it happens because of old data are not removed for versioning history). So it means that folder size will increase with every overwrite.

Should I choose Parquet in my case if I do not need the history of changes and I want to save storage space?

2 Answers

If you always need to overwrite data and do not need any history, then it is better to go for parquet, as it is compressed.

Delta, also stores the file in parquet format, along with some other metadata and version history, thus needs to store some history data too.

So you already answered your question, that if you need to optimize your storage, and always overwrite the entire dataset, I would suggest to go ahead with normal parquet.

The biggest advantage of Delta is transactionality - if you're writing at the same time as other read, they will have a consistent view of the data.

Another big advantage of the Delta - it keeps the metadata together with data. In this case, it avoids scanning of directories to discover partitions that is required when you use Parquet. I've seen customers where partition discovery took 10s of minutes even if you read one row from the table (not talking about throttling the API requests to Azure Storage account).

P.S. If you afraid of the storage size, you can decrease the retention period to 1-2 days, and run vacuum daily.

Related