loc bengaluru, ist | local --:-- srijanshukla18@gmail.com
[post]/you-a-junior-infra-techie/data-store

data store

/ 4 min read· infra

How I explain data storage choices to juniors. The questions to ask about your data first, then the usual suspects: relational databases, object stores, warehouses, NoSQL, and file systems.

Disclaimer: I have found it a lil tough to translate my mental model of this stuff into words for juniors. I can explain it to them, but I am making up stuff on the fly when I do that. So I am writing it down properly, once.

you are a junior. you gotta store some data. for your application ofcourse.

Where though? Before you pick a tool, you need to know your data. Then the tool picks itself.

ask these questions first

  1. What shape is the data?
    • Structured (spreadsheets, tables)?
    • Semi-structured (JSON, logs)?
    • Unstructured (images, videos)?
  2. How is it accessed?
    • Frequent small reads/writes (user profiles)?
    • Rarely updated, but heavily queried (analytics)?
    • Bulk storage with no direct querying (backups)?
  3. How much data is there? Gigabytes? Terabytes? Petabytes?
  4. What’s the performance need?
    • Milliseconds for queries (user-facing apps)?
    • Hours for batch processing (reports)?
  5. Who or what uses it?
    • Humans (via dashboards)?
    • Machines (APIs, apps)?

the usual suspects

Storage systems are tools for specific jobs. These are the ones you will keep running into:

ArchetypeBest forExample toolsAnalogy
Relational databaseStructured data needing ACID* transactions, complex queriesPostgreSQL, MySQL, RDSA filing cabinet with labeled folders. Strict rules, perfect for precise lookups.
Object storeUnstructured/semi-structured data, cheap bulk storageS3, GCS, Azure BlobA warehouse for boxes. Dump anything, retrieve by barcode (no search).
Data warehouseAnalytics on large structured/semi-structured datasetsRedshift, Snowflake, BigQueryA research library. Built for big questions (“Total sales last year?”).
NoSQL databaseSemi-structured data, flexible schemas, scale horizontallyMongoDB, DynamoDBA flexible shelf. Store varied items (books, tools, toys), search by tags.
File systemHierarchical data (directories of files)NFS, EFS, HDFSA physical office desk. Folders inside drawers, familiar but limited scalability.

*ACID = Atomicity, Consistency, Isolation, Durability. Critical for transactions like banking.

deciding

  1. Start with the data shape:
    • Structured → relational DB or warehouse
    • Unstructured → object store
    • Semi-structured → NoSQL or warehouse
  2. Then the access pattern:
    • Need to fetch one row fast? → relational DB
    • Need to scan millions of rows? → warehouse
    • Just storing files? → object store
  3. Then scale:
    • Small datasets → almost anything works
    • Massive datasets → object store, warehouse, or NoSQL

stuff to keep in mind

  • Hot vs cold data. Hot (frequently accessed) goes on fast storage (databases). Cold (rarely accessed) goes on cheap storage (object store).
  • Cost vs performance. Faster and structured costs more. Slower and unstructured is cheaper.
  • Flexibility. Object stores are dumb but scale forever. Databases and warehouses are smart, but the schema constrains you.

Start with the problem, not the tool.

never a hammer finding a nail to hammer please