articles / dynamodb-sql-mongodb
DynamoDB, SQL or MongoDB: field notes and comparison
Mounir Guizani · 29 November 2026 · 4 min read
I've used relational databases (Oracle, PostgreSQL, SQL Server) on banking applications, MongoDB at LCL, and DynamoDB for this portfolio. Three worlds, three ways of thinking. Here is my pragmatic take.
The fundamental difference: what do you model?
- SQL: you model the data, normalised into related tables. Queries come later, and you can write new ones at any time thanks to joins.
- MongoDB: you model documents close to the application's objects. Queries stay rich (filters, secondary indexes, aggregations).
- DynamoDB: you model the access patterns. You first list the questions the application will ask, then build the keys to answer each in a single read.
That last sentence changes everything. With DynamoDB, a question you didn't plan for can cost a redesign of the keys.
Field notes: DynamoDB for this portfolio
The site has few access patterns, all known: list missions, read a mission, list content for a technology, list contact messages by status. I chose single-table design:
| Access | Key used |
|---|---|
| Read a mission | PK = MISSION#<slug>, SK = META |
| List missions | secondary index GSI1PK = MISSION |
| Content for a technology | PK = TAG#<tech> |
| Messages by status (new, read…) | secondary index GSI1PK = MESSAGE#NEW |
| Contact form anti-spam quota | PK = QUOTA#<day>, with automatic expiry (TTL) |
The result: every page is served by a single query, with stable latency, in provisioned mode within AWS's always-free tier. For a site like this one, it's unbeatable: no database server, no connections to manage from Lambda, and zero cost.
The trade-off: if tomorrow I want "missions longer than two years, sorted by industry", I'll need a new index or filtering in the application.
Field notes: MongoDB at LCL
For the services behind the showcase site and the mobile app, MongoDB with Spring Data offered exactly what was needed: documents that look like the Java objects, a schema that evolves without heavy migrations, and flexible queries. For content and journey data whose shape changes often, it's very productive.
The watch-out is modelling: embed or reference, keep document size under control, and create the right indexes to avoid full collection scans.
Field notes: SQL in banking
In treasury and refinancing, relational is king: ACID transactions, integrity constraints, complex joins and, above all, ad hoc queries for the business, BI and controls. When data is highly related and the questions change often, nothing beats SQL. The challenge shifts to optimisation: indexes, execution plans, batch queries over millions of rows.
The comparison
| SQL (PostgreSQL, Oracle, Aurora) | MongoDB | DynamoDB | |
|---|---|---|---|
| Model | tables and relations | JSON documents | key-value / documents |
| Queries | free-form, joins | rich, aggregations | by key and index, planned upfront |
| Transactions | full ACID | multi-document possible | possible, limited in number of items |
| Schema changes | migrations | flexible | flexible, but keys are fixed |
| Scaling | vertical first, read replicas | sharding | automatic, virtually unlimited |
| Operations | server to size (or Aurora) | cluster (or Atlas) | none: fully managed |
| Idle cost | running instance | running cluster | zero on-demand, free at small provisioned capacity |
How I choose
- Highly relational data, unpredictable queries, reporting: SQL, no hesitation.
- Rich objects whose shape evolves, varied queries: MongoDB.
- Known access patterns, unpredictable volume or traffic, serverless architecture: DynamoDB.
There is no best database, only the one that fits the questions you'll ask. Write them down first; the answer often follows on its own.