iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
If a large Athena query repeatedly fails with a resource-exhaustion error, you can sometimes split the time window into smaller jobs using a deterministic modulo slice key. The key is to keep the original date or hour filters in every job, use the same slice expression across joined tables, and verify that the key distributes rows evenly. This is a workload-splitting pattern—not a special Athena modulo feature—and it is not suitable for every query.
How modulo slicing divides an Athena query
Choose a stable identifier, calculate its remainder after division by a slice count, and run a separate query for each remainder. For example, with four slices, the expression coalesce(placement_id, 0) % 4 assigns rows to slice values 0, 1, 2, or 3. The example uses a null fallback of 0; use a consistent null-handling rule that fits your data.
The approach works only when the computation can be processed independently within each slice. It is not a way to make one inherently global operation independent: a query that needs to compare or rank all rows together may still need the full dataset.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Check whether the workload and key are suitable
Pick a stable key at the join grain
Choose a high-cardinality identifier available at the same logical grain in every related table, such as an event, account, or order identifier. A yes/no field or a small set of regions is generally a poor slicing key because it can concentrate too many rows in a few slices. If joined tables use different values or grains, a shared expression may not preserve the intended row matches.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Measure distribution before scheduling jobs
Run a representative busy-window count grouped by the proposed slice expression. For example:
SELECT coalesce(placement_id, 0) % 4 AS slice_id, count(*) AS row_count
FROM your_table
WHERE event_date = DATE '2026-10-10'
GROUP BY 1
ORDER BY 1;
Replace the table, identifier, and time predicate with those for your workload. Compare the counts: a heavily overloaded slice can remain too large to succeed. If the distribution is poor, try another stable key, choose a different slice count, or handle a hot identifier separately.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Build and run the sliced queries
- Materialize the slice key. When creating curated data, calculate the slice value during the write and store it with the data. It can also be an additional partition key in the S3 layout when that layout suits the workload.
- Keep the expression identical across joined tables. Use the same identifier semantics, modulo count, and null handling everywhere the query joins data. Otherwise, matching rows can land in different slices and the join can miss results.
- Keep the original time predicates in every job. Add a filter for one slice value without removing the date or hour filters. Athena partition predicates limit reads to matching time partitions; the slice filter is an additional restriction, not a substitute.
- Schedule one job per slice. With four slices, run otherwise equivalent queries for slice values 0 through 3. Four is only an example, not a generally optimal setting.
- Review each job’s reported data scanned. If each job scans the full time window rather than only its relevant time partitions and slice, total scanned data can rise substantially—potentially to roughly the slice count times the original window. Actual scans and costs depend on the query and data layout.
A simplified filter pattern is:
WHERE event_date = DATE '2026-10-10'
AND coalesce(placement_id, 0) % 4 = 0
Repeat with values 1, 2, and 3 for the other jobs. The date predicate shown is illustrative; use the exact time filters and partition columns appropriate to your table.
Choose a slice count without creating new bottlenecks
More slices do not guarantee faster completion. A skewed key can leave one job overloaded, while a very high slice count can create more tasks and small files. AWS warns that many small files increase Athena planning and per-file overhead. Start with a count supported by the observed distribution and workload, then check the actual results rather than treating the example count of four as a target.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Also account for Athena’s documented write limits when materializing partitioned output: CTAS queries have a maximum of 100 partitions, and INSERT INTO can add a maximum of 100 partitions to a destination. See AWS’s partition limits for CTAS and INSERT INTO.
Keep time partitioning, modulo slicing, and bucketing distinct
| Design | Best suited to | Key consideration |
|---|---|---|
| Time partitioning | Queries that commonly filter by date or time | Preserve the time predicates in every slice job so Athena can restrict the scanned partitions. |
| Modulo slicing | Splitting a decomposable, resource-heavy time window into independently filtered jobs | Requires a stable, sufficiently balanced key and consistent slice calculation across joined tables. |
| Athena bucketing | Workloads that often look up specific values of a high-cardinality, uniformly distributed key | This is a stored-data organization technique with Athena-specific behavior; it is not synonymous with running modulo-filtered jobs. |
AWS recommends partition keys frequently used in filters and with low cardinality. Its bucketing guidance instead favors high-cardinality, uniformly distributed keys when queries often look up particular values. For analytic data, AWS also recommends columnar formats such as Parquet or ORC, which can reduce the columns and data read and support metadata-based skipping. These storage choices can be worth addressing before adding more query jobs.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
See AWS documentation on partitioning data in Athena, bucketing and partition-write limits, and data optimization.
Recommended Free Tools
Know when to fix the query instead
Modulo slicing is a candidate when a particular time window repeatedly exceeds resource limits, the work can be decomposed by a shared key, and the slices are reasonably balanced. It is not a good fit for work that needs all rows together, including some global distinct, ranking, or window-function calculations. In those cases, splitting can change the result or leave the global operation unresolved.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Before splitting, address avoidable costs where possible: wide CSV input, selecting unnecessary columns, or problematic joins. A better file format or narrower scan may solve the problem without multiplying jobs. The technique is described by Rahul Gupta in his SQLServerCentral article, “Split Large Queries in Athena with a Simple Modulo Trick”, published October 5, 2026. Gupta advises keeping both filters tight; treat that as guidance, not a cost guarantee, since actual scanned data depends on the query and layout.
Avoid double-counting shared output
If a reader table points to a shared parent output location, keep the layout consistent and do not write both full-window results and slice results into that same location. Duplicate files can make readers count rows twice. Use a distinct output location or a deliberate, consistent layout for the sliced results.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Free tools Windows power users keep installed
One-click scans. No signup required.

