Quick revision
The short answer
Before approving, I would ask five questions. What exactly are the query patterns, since Cassandra needs them known up front with one table per query? Does the order service need transactions or uniqueness across rows, given that lightweight transactions exist but are slow? What consistency levels will reads and writes use? Who will operate it, the team or a managed service? And is the write volume really beyond what a well-tuned relational database handles? For a typical order service, the honest answers usually point back to PostgreSQL.
What to remember
In this answer, we reviewed a proposal to use Cassandra for an order service through five questions. Query patterns must be known up front, because each needs its own table. Transactions and uniqueness across rows are limited to costly lightweight transactions. Consistency levels such as QUORUM must be chosen deliberately. Operations need experience or a managed service. And the write volume must really exceed what a tuned relational database can handle, which for most order services it does not.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Before approving, I would ask five questions. What exactly are the query patterns, since Cassandra needs them known up front with one table per query? Does the order service need transactions or uniqueness across rows, given that lightweight transactions exist but are slow? What consistency levels will reads and writes use? Who will operate it, the team or a managed service? And is the write volume really beyond what a well-tuned relational database handles? For a typical order service, the honest answers usually point back to PostgreSQL.
Why this question is asked
Write scalability is Cassandra's headline feature, and a team proposing it for a new service is often excited by benchmarks showing hundreds of thousands of writes per second. But an order service is not a sensor feed: orders are queried many ways, change state over their life, and carry money. Choosing the wrong database there is expensive to undo. Interviewers ask this scenario to see whether we can review a technology proposal with questions that expose fit, rather than with opinions. In this answer, we will go through each question, explain why it matters for Cassandra in particular, and show how the answers lead to a decision.
1A Quick Recap of What Cassandra Optimises For
Cassandra is a distributed database designed for very high write throughput and availability across many nodes and data centres. It achieves this by writing to an append-only commit log and memory, with no read before write, by spreading data across nodes according to a partition key, and by letting every replica accept writes without a single primary. The price is paid in other places: queries must name the partition key, there are no joins, no foreign keys, no general multi-row transactions, and consistency is something we tune per query rather than get by default.
So the review is really about one question: does this service need what Cassandra gives, and can it live without what Cassandra takes away?
- Query patterns known and few?YesContinueNoRelational database
- Needs multi-row transactions or global uniqueness?YesRelational databaseNoContinue
- Write volume beyond a tuned relational setup?YesContinueNoRelational database
- Team can operate it, or managed service?YesApprove with a design reviewNoManaged service or reconsider
4 steps in order. Play them, or step through them one at a time.
The order matters: the cheapest disqualifying question comes first.
2Question 1: What Are the Query Patterns?
In Cassandra, each efficient query needs a table whose partition key it names, so we design one table per query and write the same order into several tables. I would ask the team to list every query the service and its consumers need today and next year. Orders by id, orders by customer newest first, orders by status for the warehouse, orders by date range for finance, orders containing a product for support. That is five tables, each written on every order change, and each new requirement means a new table plus a backfill.
If the list is short and stable, that is workable. If the team answers that they do not know yet, or that support and finance will need ad hoc queries, that is a strong signal against Cassandra, because a relational database answers a new query with an index, while Cassandra answers it with a new table and a migration.
3Question 2: Transactions and Uniqueness Across Rows
An order service usually has invariants: an order number must be unique, stock must not go negative, and placing an order should change the order, its lines and a reservation together. Cassandra writes to one partition are atomic and isolated, and logged batches make writes to several tables eventually all happen, but there is no transaction that reads and writes several partitions with isolation.
Lightweight transactions, written with IF conditions, give compare-and-set on a single partition through the Paxos consensus protocol.
They work for uniqueness of a key, but each one costs several round trips between replicas and they contend badly under load, so a design that needs them on every order gives up much of the write throughput that motivated Cassandra. General-purpose transactions are being developed for later Cassandra versions; check the status before counting on them. If the answer is that the service needs multi-row transactions, PostgreSQL is the natural fit.
4Question 3: Which Consistency Levels?
Cassandra lets each query choose how many replicas must respond. With a replication factor of 3, ONE means one replica, and QUORUM means two. If writes and reads both use QUORUM, every read overlaps with at least one replica that acknowledged the latest write, because 2 + 2 is greater than 3, so a customer who just placed an order will see it. With ONE for writes and reads, a read may hit a replica that has not received the write yet.
I would ask the team which level each query uses and why, and what happens to the customer when a read is stale. Teams sometimes plan ONE everywhere for speed without realising that "my order disappeared" is the user-visible result. Quorum costs latency and availability during node failures, and that trade-off should be a deliberate choice.
5Question 4: Who Operates It?
Running Cassandra well takes specific skills: capacity planning per node, compaction strategy choice, regular repairs so replicas converge, tombstone management, and upgrades across a cluster. I would ask whether anyone on the team has done this in production, who is on call at night, and whether the company already runs Cassandra elsewhere. If not, a managed service such as one of the cloud providers' Cassandra-compatible offerings removes much of the operational work, but brings its own limits, pricing per request or capacity, and compatibility differences that must be checked against the features the design uses.
6Question 5: Is the Write Volume Really Beyond a Relational Database?
This is the question that most often settles it. I would ask for numbers: orders per second at peak, writes per order, and expected growth. A large shop might peak at a few thousand orders per second during a sale, each causing perhaps ten row writes, so tens of thousands of writes per second. A well-tuned PostgreSQL on good hardware, with batching, sensible indexes and connection pooling, can often handle that order of magnitude; beyond it, partitioning, read replicas or a distributed SQL database can extend it while keeping SQL and transactions. Measure with a load test on the real schema rather than trusting either side's benchmarks.
If the numbers show truly enormous write volume, such as order events from millions of devices, Cassandra may be right for that part, perhaps an event history table, while the transactional core stays relational. Splitting by workload often gives a better answer than choosing one database for everything.
7Follow-up questions
What would make you approve Cassandra for this service?
A short, stable list of key-based queries, invariants that fit within single partitions or can be enforced elsewhere, a clear consistency plan, operators or a managed service, and measured write volume beyond what a relational setup can serve at reasonable cost. With all five, I would approve and ask for a design review of the tables.
Is it acceptable to use Cassandra and a relational database together?
Yes, when each owns a clear part of the data, such as the order core in PostgreSQL and a high-volume order event history in Cassandra. The cost is running two systems and keeping them in step through events, so the split must be worth it.
How would you phrase this to the team without simply saying no?
By asking the questions and letting the answers decide, ideally with a load test they run themselves. If the team discovers that PostgreSQL handles their peak with headroom, the decision is theirs, and they keep the option of Cassandra for the part that later needs it.
8Conclusion
In this answer, we reviewed a proposal to use Cassandra for an order service through five questions. Query patterns must be known up front, because each needs its own table. Transactions and uniqueness across rows are limited to costly lightweight transactions. Consistency levels such as QUORUM must be chosen deliberately. Operations need experience or a managed service. And the write volume must really exceed what a tuned relational database can handle, which for most order services it does not.
Open with
I would ask questions rather than give an opinion. First, what are the query patterns? Cassandra needs one table per query, keyed by what the query names, so I want the full list: by id, by customer, by status, by date for finance, by product for support.
Then, if they want more
If they don't know yet or expect ad hoc reporting, that is a strong signal against it. Second, does the order service need transactions or uniqueness across rows, like unique order numbers, stock that can't go negative, or order plus reservation changing together?
Cassandra only has atomicity within a partition, and lightweight transactions with IF NOT EXISTS use Paxos, cost several round trips and contend under load, which eats the write advantage. Third, which consistency levels? With replication factor three, QUORUM writes and reads overlap so a customer sees the order they just placed; ONE everywhere can make orders seem to vanish.
Fourth, who operates it: repairs, compaction, tombstones, upgrades, on-call. Without experience I would want a managed service. And fifth, the numbers. What is the peak write rate?
A sale peak of a few thousand orders per second is often tens of thousands of row writes, which a well-tuned PostgreSQL can often handle, and I would ask for a load test on the real schema. Often the answer is PostgreSQL for the core, maybe Cassandra later for a high-volume event history.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Data reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "A team proposes Cassandra for a new order service because of its write scalability. What...": https://scrivio-interview-library.netlify.app/databases/spring-data-nosql/b4c86e6620/