Database Selection and Trade-offs Questions
Choosing the right database and data platform for a workload: relational versus NoSQL versus specialized stores, managed versus self-hosted, and matching technology to consistency, scale, cost, and query or access-pattern needs. Covers OLTP versus OLAP and transactional-versus-analytical workload splits, polyglot persistence across multiple data stores, structuring an ambiguous selection prompt, naming trade-offs, and defending a recommendation to stakeholders.
Given these query patterns, recommend the most suitable storage family and justify your choice: (a) single-key low-latency reads at 20k qps, (b) complex multi-table joins, (c) graph traversals of depth 5, (d) full-text search with relevance ranking, (e) time-window aggregations over high-cardinality keys. For each pattern, name one concrete product choice.
Sample Answer
Direct answer
There is no single storage engine that fits all five patterns well, and forcing one is the most common wrong turn on this kind of question. Map each pattern to the storage family whose native data structure was built for that access shape, then name a concrete product: (a) a key-value store for single-key reads at scale, (b) a relational database for multi-table joins, (c) a graph database for multi-hop traversals, (d) a search engine for ranked full-text search, and (e) a column-oriented analytical store for high-cardinality time-window aggregation (aggregating by a grouping key that has thousands or millions of distinct values, not just a handful of categories).
Structured elaboration
The five named patterns
| # | Query pattern | Storage family | Concrete product | Why this family fits |
|---|---|---|---|---|
| a | Single-key reads at 20,000 queries per second (QPS) | Key-value store | Amazon DynamoDB | A key-value store partitions data by key and answers a single-key lookup as one indexed read on one partition, so throughput scales by adding partitions, not by making any one query smarter. |
| b | Complex multi-table joins | Relational database (RDBMS) | PostgreSQL | The query optimizer chooses a join algorithm (nested loop, hash, or merge) from table statistics. No mainstream NoSQL engine does cost-based multi-way join planning natively. |
| c | Graph traversals of depth 5 | Graph database | Neo4j | A graph engine stores index-free adjacency: each node holds direct pointers to its neighbors, so walking a relationship is a pointer dereference. The same query in a relational store is a 5-way self-join, and join cost grows with the fan-out at each hop. |
| d | Full-text search with relevance ranking | Search engine | OpenSearch | Built around an inverted index (a map from each word to the documents containing it) plus a relevance-scoring algorithm (a BM25-family score that weighs term frequency against how common the term is corpus-wide). Relational full-text extensions exist but trail purpose-built search engines on ranking quality and on faceted aggregation speed at this kind of scale. |
| e | Time-window aggregations over high-cardinality keys | Column-oriented analytical store | ClickHouse | Columnar storage reads only the columns an aggregation touches instead of whole rows, and its execution engine processes data in batches (vectorized execution) with sparse, block-level indexing that tolerates a grouping key with millions of distinct values, a case that overwhelms a row-store B-tree index (the sorted, tree-shaped index most relational and document databases use, well suited to point lookups but not to scanning millions of distinct grouping values). |
Four more scenarios that map to the same five families. The same reasoning covers business-phrased scenarios, not just abstract query shapes:
| Scenario | Storage family | Concrete product | Why |
|---|---|---|---|
| High-cardinality time-series telemetry | Time-series-oriented store | TimescaleDB | Telemetry is append-only and almost always queried by time range. A time-series engine (here, a PostgreSQL extension) adds automatic time-based partitioning and columnar compression without giving up SQL and joins to reference data. |
| Flexible-field user profiles | Document store | MongoDB | Profile schemas vary per user or tenant and change often. A document model stores each profile as one self-describing record instead of a wide, mostly-empty relational table or a stream of schema migrations. |
| Social-graph traversal | Graph database | Neo4j | The canonical graph use case: "friends of friends of friends," the same index-free-adjacency reasoning as pattern (c), just with a social rather than a generic entity graph. |
| High-throughput key-value session store | In-memory key-value store | Redis | Sessions are ephemeral, read and written by a single key, and need automatic expiry (time-to-live, or TTL: a per-record expiration the store enforces itself). Only an in-memory engine delivers that combination at sub-millisecond latency cheaply. |
The pattern behind the pattern. Every row above reduces to the same question: what data structure does this engine keep on disk or in memory, and does the query shape match how that structure is organized? A B-tree (the structure behind most relational and document indexes) is excellent at range scans and point lookups on one key but does not represent relationships between rows; an inverted index is excellent at "which documents contain this term" but poor at exact-match point lookups; a columnar layout is excellent at "compute something over many rows, few columns" and poor at "give me this one row, all columns, fast."
Worked example
Pattern (a) is the one with a stated number, so it is the one to size. Assume single-key reads average under 4 kilobytes (KB) each (so each read consumes one strongly-consistent read request unit under DynamoDB's on-demand pricing) and run at a sustained 20,000 QPS all month.
# DynamoDB on-demand monthly cost for 20k qps single-key reads.
# Rate verified against aws.amazon.com/dynamodb/pricing/on-demand/, 2026-09.
qps = 20_000
seconds_per_month = 30 * 24 * 3600
reads_per_month = qps * seconds_per_month
price_per_million_strong = 0.125 # USD per million strongly consistent read request units
price_per_million_eventual = price_per_million_strong / 2
cost_strong = reads_per_month / 1_000_000 * price_per_million_strong
cost_eventual = reads_per_month / 1_000_000 * price_per_million_eventual
print(f"reads/month = {reads_per_month:,}")
print(f"strongly consistent monthly cost = ${cost_strong:,.2f}")
print(f"eventually consistent monthly cost = ${cost_eventual:,.2f}")
# reads/month = 51,840,000,000
# strongly consistent monthly cost = $6,480.00
# eventually consistent monthly cost = $3,240.00
Two things fall out of this. First, 20,000 QPS of single-key reads is genuinely cheap on a key-value store (about $3,200 to $6,500 a month depending on read consistency), which is the economic argument for routing this pattern away from a relational primary that would need a matching fleet of read replicas to absorb the same load. Second, the gap between strongly and eventually consistent pricing is a real design lever: if the single-key pattern can tolerate reading data that is a moment stale (most session- or profile-lookup patterns can), eventual consistency halves the bill for the same throughput.
Trade-offs & pitfalls
- Chasing one "unified" database for all five patterns to reduce operational surface is the dominant wrong turn on this kind of question. It works until the first graph or full-text requirement arrives, at which point the relational workaround (recursive joins for depth,
LIKEqueries for search) gets slow enough that a second system gets added anyway, just later and under pressure. - Recursive joins standing in for graph traversal. A relational recursive common table expression can walk a fixed depth, but cost grows with fan-out at each hop; a genuinely 5-hop traversal over a densely connected graph can make this approach unusable well before a purpose-built graph engine would struggle.
LIKE '%term%'standing in for search. It "works" for small data and no ranking requirement, then breaks the moment relevance ranking, typo tolerance, or faceted filtering is asked for, because none of that is what a B-tree index was built to answer.- Putting session data in whatever key-value store is already running, rather than an in-memory one, just to avoid adding Redis. Without an in-memory tier, both p50 and p99 latency for a cache-shaped access pattern are worse, and the per-read cost is higher than an in-memory store built for exactly this shape.
- Every store added is an operational cost, not just a technology choice: more systems to patch, monitor, back up, and staff for. Justify each addition by an access pattern the existing stores genuinely cannot serve well, not by convenience or by "we might need it later."
Compare relational and NoSQL databases for a product that needs strong transactional integrity for orders but also needs flexible, highly-scalable product catalog queries. Propose a hybrid architecture and explain data synchronization, ownership, and read/write patterns.
Sample Answer
Direct answer
Split ownership cleanly: a relational database as the system of record for orders, giving atomicity, consistency, isolation, and durability (ACID) across everything one order write touches, and a separate, read-optimized store, a document database or a search index, for the product catalog. Treat the catalog store as a derived, denormalized VIEW fed from the product data's own relational system of record, never a second source of truth, and never something the order service writes to directly.
Structured elaboration
Why relational for orders. An order write typically touches several related facts at once: creating the order, decrementing stock, recording the payment status, and writing each line item. That is exactly the multi-row, multi-table atomic transaction relational engines are built for. Losing atomicity here produces partial orders, phantom charges, or oversold inventory, all of which are correctness incidents, not just inconvenience.
Why not relational alone for the catalog. Catalog queries are read-dominated and highly variable in shape: filter by many different facets, free-text search, faceted navigation. Schema also varies per category, a shirt has size and color, a laptop has RAM and storage, so a single rigid relational schema ends up either sparse and wide or forced into a generic key-value-per-row pattern, both of which fight the query patterns a catalog actually needs. A document store's per-record schema flexibility, or a dedicated search index's inverted-index query model, fits the shape directly.
Data synchronization. Populate the catalog store through change data capture (CDC, streaming a database's write-ahead log to downstream consumers) or an outbox pattern (the product service writes an event to an outbox table inside the same transaction as its own business write, and a separate process publishes it). The flow is one-directional, from the product service's relational store outward to the catalog read model, never the reverse, and never touched by the order service.
Ownership. The product service owns product data (name, price, attributes) in its own relational store. The catalog read model, whether a document store or a search index, is a projection it publishes; nothing else writes to it. The order service owns order state exclusively. It may read product data at order time, but it writes an immutable snapshot of price and details into the order record rather than a live reference, so a later catalog price change never rewrites history.
Read and write patterns. Orders are write-moderate, strongly consistent, and low fan-out, one customer creating one order. The catalog is write-light and read-massive, with eventual consistency acceptable: a price change propagating to the search index a few seconds late is a minor UX issue, while the same delay in the order path would be a correctness bug.
Worked example
flowchart LR
ProductSvc[Product service] -->|owns, ACID writes| ProductDB[(Relational DB: products)]
ProductDB -->|CDC or outbox| CatalogIndex[(Catalog read model: document store or search index)]
Shopper -->|browse and search| CatalogIndex
Shopper -->|checkout| OrderSvc[Order service]
OrderSvc -->|reads product snapshot at order time, then owns| OrderDB[(Relational DB: orders)]
At order time, the order service reads current price and availability from the product service, but writes that price into the order's own line items as a fixed value. A later price change in the product service, and its downstream propagation to the catalog index, never touches an already-placed order.
Trade-offs and pitfalls
A pitfall is letting the order service query the catalog's live document store or search index for "current" price at checkout instead of the product service's own transactional data, which risks a race if price changes mid-checkout. Always snapshot the price into the order at commit time from the authoritative source.
A second pitfall is trusting the catalog's stock number as authoritative for checkout because it is convenient to read. CDC and outbox pipelines lag by design; that lag is fine for browsing, but the actual stock decrement at checkout must go through the order service's own transactional path, re-verified against the real number, not the catalog's possibly-stale copy.
What would flip the recommendation: a catalog small enough, a few thousand SKUs with a simple, largely uniform schema, that the flexible-query need never really materializes. At that scale a single relational database with good indexing serves both orders and catalog fine, and introducing a second store is unwarranted complexity.
Describe your approach to selecting a managed database (for example: RDS, Cloud SQL, DynamoDB, Cosmos DB) for a transactional e-commerce system that expects 10,000 requests per second and is read-heavy. Discuss consistency and isolation requirements, scaling patterns (read replicas/sharding), HA and backup strategies, operational cost considerations, and a migration strategy from an on-prem relational database.
Sample Answer
Direct answer
Recommend a managed relational database, specifically Amazon Aurora (or Cloud SQL if the organization is GCP-committed) over DynamoDB or Cosmos DB, because "transactional e-commerce system" implies orders, inventory, and payments, where relational integrity, foreign keys, and multi-table transactions are the core requirement, and because migrating from an existing on-prem relational database favors staying relational for the lowest-risk cutover. Meet the 10,000 requests per second (RPS), read-heavy requirement with a read-replica fleet in front of a single primary, sized to the actual read volume, rather than reaching for a NoSQL rewrite the workload's transactional shape does not call for.
Structured elaboration
Consistency and isolation. The default isolation level depends on which Aurora edition is chosen, and it is worth stating explicitly rather than treating "Aurora" as one uniform engine. Aurora PostgreSQL defaults to READ COMMITTED (each statement sees only data committed before that statement began), the same default as standalone PostgreSQL. Aurora MySQL defaults to REPEATABLE READ, on both the primary instance and its read replicas, the same default as standalone MySQL's InnoDB storage engine; this is a real, current difference between the two Aurora editions, not an implementation detail to gloss over. Both editions also support SERIALIZABLE, and Aurora MySQL additionally supports READ UNCOMMITTED, for the rare operation that needs a different guarantee than its default. This matters concretely for e-commerce correctness under either default: decrementing inventory on checkout is a classic race-condition risk in an application that checks stock with one statement and decrements it with a separate one, since two concurrent checkouts can both read the same available quantity before either commits its decrement, regardless of which isolation level is in force between the two statements. The fix is either an explicit row lock (SELECT ... FOR UPDATE before the decrement) or a single atomic conditional statement (UPDATE inventory SET stock = stock - 1 WHERE sku = ? AND stock > 0, whose own WHERE clause is evaluated against the latest committed row under both Aurora editions' locking-read behavior for DML, not against an older snapshot), not a blanket, connection-wide isolation-level change, since stronger isolation everywhere adds unnecessary contention on the vast majority of read-only traffic.
Scaling. The stated 10,000 RPS is described as read-heavy; work out roughly how much of that 10,000 is actually reads before sizing anything. Under a typical 90/10 read/write split, that is 9,000 read RPS and 1,000 write RPS, comfortably within a single well-tuned relational primary's write capacity, while the read side scales horizontally with replicas. Sharding is not the right first move here: it is a real option only once write throughput alone, not read throughput, outgrows a single primary, which this workload's stated shape does not indicate.
High availability and backups. A managed relational engine's Multi-AZ (multiple availability zone) configuration provides automated failover (automatically promoting a standby replica to primary and redirecting traffic when the current primary fails) designed to complete quickly, though the exact figure varies by engine version and configuration and should be validated against the current documentation for the specific engine and version chosen rather than assumed from memory. Continuous backup to durable object storage, supporting point-in-time recovery to any second within a retention window, is a standard, built-in feature of managed relational offerings and should be treated as a baseline requirement, not an added extra, for a transactional e-commerce system.
Operational cost. Cost scales primarily with the read-replica fleet size (see worked example) plus the primary's own instance cost; reserved-capacity pricing for the predictable baseline load, combined with a cache layer (Redis, cache-aside in front of the hottest, most-repeated reads such as product detail pages) to reduce the replica fleet's actual load, is the standard way to control this cost without sacrificing the read-scaling story.
Migration strategy from on-prem. If the on-prem source is already MySQL- or PostgreSQL-compatible, the path is comparatively low-risk: a managed migration service (for example, AWS Database Migration Service, DMS) can perform an initial bulk load followed by continuous change-data-capture replication (streaming every subsequent row-level change from the source database as it happens, instead of copying the data only once), allowing a cutover with a short, well-tested downtime window rather than a long, risky one. If the on-prem source is a different engine entirely (Oracle or SQL Server, for example), the same migration service typically needs a schema-and-code conversion tool (AWS Schema Conversion Tool, SCT, or an equivalent) to translate stored procedures, data types, and engine-specific SQL, which is a substantially larger and riskier effort that is easy to underestimate at planning time; flag this explicitly as a distinct, higher-risk migration path rather than treating "migrate to a managed relational database" as one uniform effort regardless of the source engine.
Worked example
Size the read-replica fleet against the 90/10 read/write split assumption, using a stated per-replica capacity for simple, indexed reads.
# read-replica sizing for a 10,000 RPS, read-heavy e-commerce workload.
import math
total_rps = 10_000
read_fraction = 0.9
read_rps = total_rps * read_fraction
write_rps = total_rps * (1 - read_fraction)
reader_capacity_rps = 4000 # illustrative sustained capacity for simple, well-indexed reads per reader instance
readers_needed = math.ceil(read_rps / reader_capacity_rps)
print(f"read RPS = {read_rps:,.0f}, write RPS = {write_rps:,.0f}")
print(f"readers needed at ~{reader_capacity_rps}/sec each = {readers_needed}")
# read RPS = 9,000, write RPS = 1,000
# readers needed at ~4000/sec each = 3
Three read replicas, comfortably within a standard managed relational cluster's typical reader-instance limit, sustain the 9,000 read RPS under this stated assumption, and the remaining 1,000 write RPS is well within a single modern primary instance's write capacity. This is the concrete basis for recommending read replicas over sharding: the workload's actual numbers, once the read/write split is made explicit, do not justify the added complexity of a sharded write path.
Trade-offs & pitfalls
- Treating "10,000 RPS" as a write-scaling problem without first splitting it into its read and write components; the worked example shows the actual write load is modest once that split is made explicit.
- Applying a strong isolation level globally to fix one specific race condition (like inventory decrement), rather than scoping the stronger guarantee to the specific transaction that needs it, which unnecessarily slows down the other 90% of the traffic that does not.
- Underestimating a cross-engine migration (Oracle or SQL Server to a MySQL- or PostgreSQL-compatible managed database) as equivalent in effort to a same-engine migration. The schema-and-code conversion step is a materially larger project and a materially higher risk, and needs to be scoped and communicated as such from the start.
- Skipping a cache layer and relying entirely on read replicas to absorb read load. A cache in front of the hottest, most-repeated reads (product pages, category listings) reduces both replica count and cost more cheaply than adding another replica.
- Assuming a specific failover time figure from memory rather than the current documentation for the chosen engine and version. Automated failover time is a real, checkable, and version-dependent number; verify it against the current source before committing to it in a design document or an SLA conversation.
You must evaluate three candidate databases for a write-heavy leaderboard system: Redis (in-memory), Cassandra (wide-column), and PostgreSQL (disk-backed). Define benchmark scenarios (writes/sec, reads/sec, read-after-write latency, data size), key failure modes to test, and what metrics and SLOs you would use to pick the right platform.
Sample Answer
Direct answer
Expect Redis to win a leaderboard-shaped write-heavy benchmark, because its sorted-set data structure is purpose-built for exactly this access pattern, with Cassandra as the fallback once the working set genuinely outgrows what fits comfortably in memory, and PostgreSQL as the control that will most likely lose on raw write throughput but establishes the transactional-safety baseline the other two are measured against. That expectation is a hypothesis, not the answer: the actual answer to "evaluate three candidates" is the benchmark design below, built so the result is decided by measurement, not by which system sounds best on paper.
Structured elaboration
Benchmark scenarios to define, each with an explicit target, not a vague description.
| Dimension | What to define | Illustrative target for this exercise |
|---|---|---|
| Writes per second | Sustained score-update rate during a realistic peak (a live event, a tournament) | See worked example: derived from a stated player and update-rate assumption |
| Reads per second | Leaderboard views (top-N plus "my rank") during the same peak | Derived from a stated viewer-to-player ratio |
| Read-after-write latency | Time from a score update to that update appearing in a subsequent top-N read | Under 1 second at the 99th percentile (p99), a reasonable real-time-leaderboard expectation |
| Data size | Number of distinct players in the working set, and average bytes per entry | Drives whether the working set fits the tested memory budget, the central question for Redis specifically |
Failure modes to test, one per candidate plus one cross-cutting. Node or primary failure mid-write-burst: for Redis, verify whether a failover (the automatic process of promoting a standby replica to primary and redirecting traffic when the current primary goes down) during an unacknowledged asynchronous replication window can lose the most recent writes, and whether that risk is acceptable or needs to be closed with a stronger write-acknowledgment setting (accepting the latency cost of waiting for a replica to confirm). For Cassandra, verify behavior under a network partition: does it continue accepting writes per the configured consistency level, and do replicas correctly reconcile once the partition heals. For PostgreSQL, verify failover behavior with a managed or self-managed replication topology and measure how long writes are actually unavailable during the failover window. Cross-cutting: run a genuine network partition or node-kill during the sustained peak load from the writes/reads targets above, not against an idle system, since failure behavior under load is the behavior that matters.
Metrics and service-level objectives (SLOs) to observe. Write latency, p50 and p99. Read latency, p50 and p99. Read-after-write staleness distribution (not just an average, the tail is what a user actually notices). Replication lag under load. Error rate during the fault-injection window. Time to return to SLO-compliant behavior after a failure resolves. And one candidate-specific early-warning metric each: for Redis, memory headroom against maxmemory and the active eviction policy (if the working set exceeds available memory, Redis evicts keys per policy, commonly least-recently-used, which can silently and incorrectly drop leaderboard entries if the eviction policy is not deliberately scoped away from leaderboard keys); for Cassandra, compaction backlog (a growing backlog under sustained high write rate is the leading indicator that read latency is about to degrade, well before it visibly does); for PostgreSQL, table and index bloat ratio from autovacuum lag (a write-heavy pattern that repeatedly updates the same rows, exactly what leaderboard score updates do, is the classic case that causes PostgreSQL's multi-version concurrency control, MVCC, to accumulate dead row versions faster than autovacuum reclaims them, degrading both read and write latency over time if unaddressed).
Why these three failure modes are not interchangeable, and why they matter more than the raw throughput numbers. A benchmark that only measures steady-state throughput will make all three candidates look reasonable; the failure modes above are each a specific, well-known weak point of a write-heavy pattern on that particular engine, and a benchmark that skips them will not catch the actual production incident each engine is prone to.
Worked example
Derive the writes/sec and reads/sec targets from a stated scenario, and check Redis's working-set memory budget against a stated player count, since memory headroom is the single most consequential capacity question for a Redis-based design.
# benchmark target derivation for a write-heavy leaderboard.
players = 5_000_000
updates_per_player_per_day = 40 # match/score events per active player per day
writes_per_day = players * updates_per_player_per_day
writes_per_sec_avg = writes_per_day / 86400
peak_multiplier = 6 # evening/event-driven peak concentration
writes_per_sec_peak = writes_per_sec_avg * peak_multiplier
print(f"avg writes/sec = {writes_per_sec_avg:,.0f}, peak writes/sec (x{peak_multiplier}) = {writes_per_sec_peak:,.0f}")
# Redis working-set sizing for a large leaderboard.
lb_players = 20_000_000
bytes_per_entry = 200 # member id + score + sorted-set node overhead, illustrative
working_set_gb = lb_players * bytes_per_entry / 1e9
replication_factor = 2 # primary + 1 replica for HA
headroom = 1.3
total_ram_gb = working_set_gb * replication_factor * headroom
print(f"working set = {working_set_gb:.1f} GB for {lb_players:,} players")
print(f"RAM budget with {replication_factor}x replication and {headroom}x headroom = {total_ram_gb:.1f} GB")
# avg writes/sec = 2,315, peak writes/sec (x6) = 13,889
# working set = 4.0 GB for 20,000,000 players
# RAM budget with 2x replication and 1.3x headroom = 10.4 GB
Two results worth acting on. First, peak write load (about 13,900 writes per second under these stated assumptions) is well within what all three candidates can sustain in isolation; the benchmark's value is in the failure-mode and tail-latency behavior at that load, not in whether any of the three can technically keep up. Second, a 20-million-player leaderboard's working set is only about 4 gigabytes, comfortably fitting in a single modestly sized Redis instance with room to spare for replication and headroom, well under commonly available managed-instance memory tiers. The real trigger for moving off Redis toward Cassandra is not this leaderboard's size, it is a leaderboard an order of magnitude or two larger, or one that needs to retain full historical score events (not just current standings) indefinitely, which no longer fits an in-memory design economically.
Trade-offs & pitfalls
- Benchmarking only steady-state throughput. All three candidates will look acceptable; the failure modes above are where the real differentiation, and the real production risk, actually lives.
- Assuming Redis's async replication failover is safe by default. It is not, without an explicit stronger write-acknowledgment configuration, which trades some write latency for the durability a leaderboard's ranking correctness actually needs.
- Missing a Cassandra compaction backlog until read latency has already visibly degraded. Compaction backlog is a leading indicator specifically because it degrades before the symptom (slow reads) becomes obvious; alert on the backlog metric itself, not just on read latency.
- Treating PostgreSQL's bloat risk as a generic "Postgres is slower" conclusion, rather than the specific, addressable cause it is: hot-row updates outrunning
autovacuum. Tuningautovacuumaggressiveness for the specific hot table, or restructuring the update pattern, is a real fix, not a reason to dismiss PostgreSQL outright for smaller-scale versions of this workload. - Setting the read-after-write latency SLO too strictly for the actual product requirement. A live global leaderboard tolerating roughly a second of staleness is normal and expected; over-specifying "instant" consistency here adds real engineering cost for a UX improvement users are unlikely to notice.
Explain the differences between ACID and BASE properties and between strong, causal, and eventual consistency models. Describe how these models affect availability, latency, developer mental models, and operational complexity in distributed databases. Provide one concrete example where BASE is acceptable and one where ACID is required.
Sample Answer
Direct answer
Atomicity, consistency, isolation, durability (ACID) describes the guarantee a traditional relational transaction gives you: it either fully happens or not at all, it leaves the database in a valid state, it's isolated from other concurrent transactions, and once committed it survives a crash. Basically available, soft state, eventually consistent (BASE) describes the opposite design philosophy many distributed NoSQL systems adopt: stay available under load or partition by relaxing the promise that every read reflects the very latest write, accepting instead that replicas will converge soon rather than agree immediately.
Structured elaboration
The consistency spectrum between these two poles:
- Strong consistency: every read sees the latest committed write, as if there were a single copy of the data. Requires real-time coordination (for example a synchronous quorum acknowledgment) and so costs latency, and availability during a partition.
- Causal consistency: operations that are causally related (a reply is seen after the comment it replies to) are seen in the same order by everyone, but unrelated operations may appear in different orders on different replicas. Weaker coordination cost than strong consistency, while still preserving the orderings that usually matter to users.
- Eventual consistency: no ordering guarantee during propagation at all, only a promise that, absent new writes, all replicas will eventually agree. Cheapest in coordination cost, but pushes the most burden onto the application to tolerate or reconcile temporarily stale or conflicting reads.
Effects on the system and the team. Strong consistency costs latency and can cost availability during a partition, because the system has to wait for coordination before responding. Eventual consistency buys low latency and continuous availability, at the cost of a genuinely harder developer mental model: for example a user posts a comment, refreshes the page, and briefly doesn't see it because their read landed on a replica that hasn't caught up yet (a read-your-own-writes anomaly). Operationally, eventually-consistent BASE systems need an explicit conflict-resolution strategy for when two replicas accept concurrent writes to the same key: last-writer-wins by timestamp (simplest, but it silently discards whichever write loses the timestamp comparison), vector clocks (each replica tags its writes with a counter per replica, so the system can tell a truly concurrent write from one that clearly happened after another, instead of guessing), or conflict-free replicated data types (CRDTs: data structures like counters or sets built so that merging two conflicting versions always lands on the same result, no matter what order the merge happens in). ACID systems push that complexity into lock and isolation-level tuning on a single logical system instead.
Worked example
Where ACID is required: transferring funds between two accounts in one database. Debiting account A and crediting account B must both happen or neither happens (atomicity), and no concurrent read may observe a state where money has left A but hasn't yet arrived in B (isolation). This is the textbook case for a transaction wrapped in BEGIN/COMMIT on a relational engine like Postgres, because the cost of a partial or visibly-inconsistent transfer is unacceptable.
Where BASE is acceptable: a "like" or view counter on a social media post. If two regions briefly disagree on the exact count for a few seconds after a write, no one is harmed, and a system that stays available everywhere and converges shortly after (an eventually-consistent counter in a system like Cassandra, or a DynamoDB table read with eventually consistent reads) is a better engineering trade than paying synchronous cross-region coordination latency on every single increment.
Trade-offs & pitfalls
Real production systems are rarely purely one or the other. Postgres's own default isolation level (read committed) is weaker than full serializability, so "we use a relational database" doesn't automatically mean every transaction gets the strongest possible ACID guarantee available; the specific isolation level chosen matters, from read committed up through serializable (the strictest level, where concurrent transactions are guaranteed to behave as if they ran one after another in some order, ruling out the anomalies a weaker level would allow), and each level permits a different set of anomalies. Conversely, "NoSQL means BASE" is also an oversimplification: many document databases offer strong, majority-acknowledged writes or single-document transactional guarantees for a scoped operation. The consistency guarantee is a property of the specific system and its configuration, not a label that comes free with a product category.
Unlock Full Question Bank
Get access to all Database Selection and Trade-offs interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.