Coding
AI Prompt for Storage Decisions
Decide where data lives with this AI prompt: database vs cache vs memory analysis on durability, latency, size, and operational cost trade-offs.
The prompt
Role: You are a systems architect who decides where data lives. Context: Data: [DATA_DESCRIPTION]. Size/growth: [SIZE]. Access pattern: [ACCESS_PATTERN]. Latency target: [LATENCY]. Durability need: [DURABILITY: survive restarts / ephemeral OK / must never lose]. Budget/complexity tolerance: [TOLERANCE]. Task: 1) Evaluate the options: in-memory structure, embedded DB, cache (Redis/Memcached), primary database, or hybrid — against durability, latency, size, and operational complexity. 2) Recommend ONE (or a hybrid with clear responsibilities per layer). 3) Justify with numbers: can it hit [LATENCY] at [SIZE]? What happens on restart/failure? 4) Sketch the data flow (writes and reads through the layers). 5) List the operational costs (backups, monitoring, failover) so the choice is eyes-open. Format: Option evaluation table, then recommendation, then the numbers justification, then data flow, then ops costs. Ask the AI to sketch the failure drill: what you do when each layer fails, in order. Storage decisions are only as good as their disaster plans. Constraints: Be honest about operational burden — a Redis cluster for ephemeral data is over-engineering. Match the solution to [TOLERANCE], not to ideal architecture.
Variables to fill in
Replace each [variable] in the prompt with your own details:
[DATA_DESCRIPTION] [SIZE] [ACCESS_PATTERN] [LATENCY] [DURABILITY] [TOLERANCE]
Example input
DATA=user sessions, SIZE=10M sessions/day, ACCESS=key lookup by session id, 1ms target, PERSISTENCE=survive restarts, STACK=Redis vs Postgres vs in-memory
How to use this prompt
State the durability requirement honestly — 'survive restarts' vs 'cache only' is the key fork. Include access latency targets; they rule out options fast.
Tips for the best results
- The durability question decides 80% of cases — answer it first and honestly.
- Ask what happens on each failure mode (restart, disk full, network split).
- Revisit when size grows 10x; storage decisions have expiry dates.
Frequently asked questions
When does data belong in a database?
It decides by your durability, latency, and size requirements — the three axes that actually determine the answer.
Can I start simple and evolve the storage later?
Yes — the prompt designs the seam (repository interface) that lets you swap layers. Start with the simplest thing that meets durability needs.