Object Storage, Partitioning and Data Lake Layout
Organise data in S3, GCS or ADLS with sensible paths, Hive-style partitions, file sizing and lifecycle rules so data lakes do not become data swamps.
Intermediate · about 4 hours · difficulty 3/5
Learn first: Columnar Formats: Parquet and ORC
Object storage (Amazon S3, Google Cloud Storage, Azure Data Lake Storage) is the cheap, durable foundation of most data platforms. How you lay out files there decides query speed and cost.
Object storage basics
- Buckets and keys, not real folders. "Directories" are prefixes.
- Extremely durable and cheap per GB, but each request has latency and cost, so many tiny files are expensive.
- Storage classes (standard, infrequent access, archive) and lifecycle rules move or delete old data automatically.
Partitioning
- Hive-style partitions put column values in the path:
s3://lake/silver/orders/dt=2026-10-24/. - Engines skip partitions that do not match the filter (partition pruning).
- Partition on columns that queries filter by and that have low to moderate cardinality: date is the classic choice. Partitioning by
customer_idcreates millions of tiny folders.
Layout conventions
- Separate zones:
raw/(landing, immutable),bronze/,silver/,gold/or similar. - Include source and table in the path, and write each run to a deterministic location so reruns overwrite rather than duplicate.
- Compact small files periodically.
Security
Block public access, use IAM roles rather than access keys in code, enable encryption and versioning on critical buckets.
Pitfalls
- Over-partitioning (by date and hour and city) leading to thousands of tiny files per day.
- Public buckets leaking customer data; this has caused real Indian data breaches.
- Listing millions of objects in a prefix on every job run.
You are ready to move on when you can design the folder and partition layout for an orders lake, justify the partition column, and explain how a rerun of yesterday's job avoids creating duplicates.
Key concepts
- Buckets, keys and prefixes
- Hive-style partitioning
- Partition column choice
- Small files problem and compaction
- Zones: raw, bronze, silver, gold
- Lifecycle rules and storage classes
- Bucket security and encryption
Mini project
Using MinIO in Docker (S3-compatible) or a free-tier S3 bucket, write a dataset partitioned by date. Query it with DuckDB with and without a date filter, and compare how many files are read.
Check yourself
Why is partitioning a table by user_id usually a bad idea, and what would you do instead to speed up per-user queries?
Free resources
- Amazon S3 documentation (AWS)
- Google Cloud Storage documentation (Google Cloud)
- BigQuery partitioned tables (Google Cloud)