A data engineer notices that an Amazon Athena query on a partitioned table in S3 scans more data than expected. The table is partitioned by year, month, day. The query includes a WHERE clause on a non-partition column but also filters on day='2023-01-01'. What is the most likely cause of the excessive data scan?
If the partition column is defined as string but folders are dates, pruning fails and full scan occurs.
Why this answer
The most likely cause is that the partition column data type in the table definition does not match the actual partition folder names. Athena uses the folder names to determine which partitions to scan (partition pruning). If the data type mismatch causes Athena to be unable to correctly interpret the folder names, partition pruning fails, and Athena scans all partitions, leading to excessive data scan.
Option A is incorrect because JSON format does not prevent partition pruning; it may affect compression but not pruning. Option B is incorrect because the WHERE clause filters on a non-partition column, but it also filters on the partition column 'day', so partition pruning should work if the column data type matches. Option D is incorrect because sorting within partitions does not affect scan size; it affects query performance but not the amount of data scanned.