Database / Apache Cassandra Intermediate and Advanced interview questions
What is a materialized view in Cassandra?
A materialized view (MV) is a server-managed table that Cassandra automatically keeps in sync with a base table, letting you query the same data with a different partition/clustering key layout without hand-writing your own denormalization logic.
CREATE MATERIALIZED VIEW orders_by_status AS SELECT order_id, status, created_at FROM orders WHERE status IS NOT NULL AND order_id IS NOT NULL PRIMARY KEY (status, order_id);
- Every write to the base table is asynchronously propagated to update the corresponding row(s) in the view.
- The view has its own partition/clustering key structure, so it can support query patterns the base table's primary key can't.
- You cannot write directly to a materialized view — all writes must go through the base table.
Materialized views remove the need to manually write to two tables in your application code, but they add write amplification (every base write triggers a view update) and have had known consistency edge cases during node failures or repairs. Many teams still prefer manually managed denormalized tables for critical query paths, treating MVs as convenient but not fully mature for high-stakes production use.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
