The concept Ask the right question
The wrong question is: should we use PostgreSQL, DynamoDB or MongoDB? The right question is: what data do we need to store, how will applications use it, and what consistency and performance does the business require? Apex's core entities are payments, settlements, providers, loans, reconciliation results, exceptions, adjustments and audit records, and they are related: one loan has many payments, a payment may wait unmatched for settlement, an adjustment needs approval and an audit record.
In detail What each kind is good at
| Storage | Useful when | Watch out for |
|---|---|---|
| Relational (PostgreSQL, Aurora, RDS, SQL Server) | Well-defined relationships, constraints, joins, reliable transactional updates | Schema evolution, horizontal scaling, expensive queries, write contention. Consistency is not identical everywhere: it depends on the engine, the isolation level and whether you read from a replica that lags |
| NoSQL (DynamoDB, MongoDB, Cassandra) | Predictable key-based access at very large scale; flexible documents | Partition keys, hot partitions, indexing, duplicated data. Consistency settings vary by product. Many support transactions (DynamoDB and MongoDB do), each with its own limits to check |
| Object storage (S3 and similar) | Large files and unstructured content | It is not a transactional database |
| Search index | Flexible full-text investigation | Keeping it in sync with the source |
| Data warehouse or lakehouse | Historical analytics | Freshness and cost of large scans |
| Time-series database | Telemetry and sensor readings | Retention and downsampling |
| In-memory cache | Temporary fast reads | Stale data and cache invalidation |
The method Decide from access patterns
- What are the main reads, and the main writes?
- Must several records change atomically together?
- Do queries need relational joins?
- How often does the schema change, and how many records will there be?
- How long must records be kept?
- What query latency and which consistency model are acceptable?
- How do backups and recovery work?
Apply it A candidate design for Apex
| Data | Candidate storage | Why |
|---|---|---|
| Payments, settlements, matches, exception state, approvals | Relational database | Related records, transactions, constraints, audit-friendly |
| Original settlement and provider files | Object storage | Whole files kept as received, for evidence and replay |
| Free-text investigation search | Search index, only if justified | Add it only if users need flexible search |
| Long-term reporting history | Analytics platform, only if needed | When reporting load outgrows the transactional database |
| Audit history | Append-only tables, plus write-once object storage for archived copies | Records must not be changed or deleted before their retention period ends |
Audit records need three answers before you design them: how long they must be kept (Apex: seven years, from the compliance policy), how they are protected from change (append-only tables, and write-once storage such as S3 Object Lock for archives), and how they are deleted when the period ends. Deletion must follow a policy that legal and compliance have approved, including legal holds that pause it. Never decide retention or deletion yourself.
Practice Place six kinds of data
Practical exercise
Where does it belong?
Choose storage for each item and state your consistency and retention assumption.
- Payment transaction records.
- Settlement source files.
- Exception investigation state.
- Long-term historical reporting.
- Operational search data.
- Audit history.
Show sample answers
- Payments: relational; strong consistency; retained for the financial retention period.
- Settlement files: object storage, unchanged as received; retained as evidence.
- Exception state: relational, in the same transactions as the matching results.
- Historical reporting: analytics storage fed nightly, if the volume requires it.
- Operational search: a search index only if users need free-text search; rebuilt from the source.
- Audit history: append-only relational records, never updated or deleted, retained per compliance.
3 questions
Check your understanding
What you can do now
- Start a storage decision from the data model.
- Explain what relational, NoSQL, object and analytics storage are good at.
- Decide storage from access patterns, consistency and retention.