> ## Content Index
> Fetch the complete content index at: https://abundance.alloconomy.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Choose a layout from a real filter
- URL: https://abundance.alloconomy.com/alloconomy/de-interview-choose-a-layout-from-a-real-filter/
- Published: 2026-11-22T05:05:22.000Z
- Updated: 2026-11-22T16:31:57.000Z
- Description: A year of dispatches occupies 36.5 TB, roughly 100 GB per day.
- Author: Sathya Narayanan
- Tags: Alloconomy, Data Engineering, Data Engineering Interview Field Guide, #web-only, #series-detail, #Import 2026-11-21 19:24, Physical design and serving

1. [Collection · 10 seriesThe Data Engineering Interview Field Guide](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)
2. [Series opening · 3 essaysPhysical design and servingSeries 8 of 10](https://abundance.alloconomy.com/alloconomy/de-interview-one-order-lookup-and-a-year-of-shipments/)
3. This essay2 of 3

Data engineering · 3 essays

Physical design and serving

Complete reading path · You are in Part 2 of 3
1. Part 1[One order lookup and a year of shipments](https://abundance.alloconomy.com/alloconomy/de-interview-one-order-lookup-and-a-year-of-shipments/)Support needs the latest status for one order at p95 below 150 ms.
2. Part 2**Choose a layout from a real filter**Current essayA year of dispatches occupies 36.5 TB, roughly 100 GB per day.
3. Part 3[When one school district becomes half the traffic](https://abundance.alloconomy.com/alloconomy/de-interview-when-one-school-district-becomes-half-the-traffic/)A marketplace peaks at 12,000 writes per second.

## The interview prompt

A year of dispatches occupies 36.5 TB, roughly 100 GB per day. Most finance queries read seven days, and one seller demands a one-order lookup. Sketch the partition and clustering strategy, then show what it cannot guarantee.

## Estimate the bytes that could be skipped

With an even day distribution, a seven-day request touches roughly 700 GB before column pruning and compression effects. Date pruning could eliminate the other 35.8 TB from a full-year scan. That assumes the engine recognizes the predicate and the physical files line up with the filters. Inspect the number of files opened and actual bytes read.

Partitioning also by 10,000 sellers creates up to 10,000 seller-day groups a day. At 100 GB per day, an even distribution averages only about 10 MB per group. Real sellers are uneven, leaving many tiny groups and a handful of large ones. Clustering within a coarser date layout may offer useful filtering without that file count. A one-order support lookup may justify a separate keyed access path.

Keep a late-correction case on the board. A dispatch received today with last month’s event date belongs to an older business range. Determine how it is merged, which snapshots readers can see during the update, and when old files are retired. A partitioning argument is incomplete until someone can explain how the data is written and maintained.

## The model behind the answer

The buyer reads the last four weeks of dispatches. Partitioning files by dispatch date lets the engine skip older data. Within the selected dates, clustering or sorting by a commonly filtered field can reduce reads further, depending on the engine and file statistics. Measure files opened and bytes scanned as well as elapsed time. A warm cache can flatter a poor layout.

There is a cost to finer partitions. A partition per seller per hour can create thousands of tiny files, with more time spent planning and opening them than reading data. Choose a coarser boundary, compact small files, and test filtered scans again. A correction received today for a dispatch last month must still find the right logical row.

Apache Iceberg illustrates the separation between logical grain and physical layout. A table can evolve its partition specification and retain the metadata required to read files written under earlier specifications. Newly written data can use the new layout while older files keep theirs. [Apache Iceberg on partition evolution](https://iceberg.apache.org/docs/latest/evolution/?ref=abundance.alloconomy.com)

## Review an agent’s physical design experiment

Give the agent one week of representative query predicates and ask for a repeatable comparison of two layouts. Include an order lookup and a correction to last month. Record the logical answer, files opened, actual bytes read and bytes rewritten.

**Reviewer decision.** Seven evenly sized days represent about 700 GB of logical input in the example. Treat that as a sizing assumption. If a proposed layout opens thousands of tiny files or shifts cost onto corrections, show the measured trade-off before selecting it. SQLite examples elsewhere in the guide cannot establish this warehouse result.

*Further reading.* [Designing Data-Intensive Applications](https://www.amazon.com/dp/1098119061?ref=abundance.alloconomy.com), 2nd ed., on partitioning, clustering and range access in warehouses.

## One more question

Last month the table switched from month to day partitions. Do earlier queries automatically enjoy day-sized files for all history?

Check your reasoning

An evolving table format can support both layouts. Older files keep their physical organization until rewritten. Benchmark recent and historical ranges independently, then compare the savings from a rewrite with its compute and operational cost.

1. [Back to the series openingPhysical design and servingSeries 8 of 10](https://abundance.alloconomy.com/alloconomy/de-interview-one-order-lookup-and-a-year-of-shipments/)
2. [Explore the collectionThe Data Engineering Interview Field Guide](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)

[Previous · One order lookup and a year of shipments](https://abundance.alloconomy.com/alloconomy/de-interview-one-order-lookup-and-a-year-of-shipments/) · [Next · When one school district becomes half the traffic](https://abundance.alloconomy.com/alloconomy/de-interview-when-one-school-district-becomes-half-the-traffic/) · [Complete series map](https://abundance.alloconomy.com/alloconomy/data-engineering-interview-field-guide/)