2 0
Read Time:2 Minute, 1 Second

Huge file vs Smaller Chunks: During this post we will discuss about the benefits of  splitting the Huge file into small chunks. We have seen that ingesting the one huge file using COPY command takes unexpecting load time as compare to the smaller chunks. Also this leads to the Warehouse costing as processing the huge file makes warehouse available during that whole period. As per snowflake its recommended to spilt the file with size of 150 MB .

According to the snowflake documentation:

Split larger files into a greater number of smaller files to distribute the load among the compute resources in an active warehouse. The number of data files that are processed in parallel is determined by the amount of compute resources in a warehouse. We recommend splitting large files by line to avoid records that span chunks.

To prove the above pointers we will try to process one huge file and notice the Time taken by complete process. Later on we will spilt the same file into smaller ones based on the lines and try to process these files in parallel. Later on we will see the time variance  for both process.

Say we have copied a big file (3.2 GB for demo) to our S3 bucket.

Huge File

In Snowflake perform the following actions:

  • Create Storage Integration.
  • File Format.
  • Create table and stages.
  • Load the complete file into table using XS warehouse.
  • File gets loaded to table in 2m35 sec.
Huge File Load

After the file load, check the size in Snowflake and it reduces to only 480 MB.

Huge File Compress

Split Files:

Now test the same on multiple files. We will see how Snowflake leverage the multiple CORES features and  instead of occupying only one thread ,parallel thread would be used to copy the files at same time.

Split File

Now load these files in snowflake:

Split File Load

Here we see. All data gets load in only 51 sec. There is huge improvement compare to the loading the big file as against to split the file in smaller chunks.

Split File Compress

 

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *