Database / ScyllaDB Interview questions
How do you apply TTL to data in ScyllaDB?
Time-to-live (TTL) can be set per-write in seconds, either on an individual INSERT/UPDATE statement or as a table-wide default, after which the data is automatically marked for deletion.
INSERT INTO sessions (session_id, user_id, data) VALUES (uuid(), 'user123', 'payload') USING TTL 3600; -- expires in 1 hour CREATE TABLE cache (k text PRIMARY KEY, v text) WITH default_time_to_live = 86400;
Once a row or column's TTL elapses, it isn't deleted immediately; ScyllaDB writes a tombstone that marks it as expired, and the underlying data is physically removed later during compaction. TTL is a common building block for session data, caches, and rate-limiting counters, but heavy TTL usage benefits from the Time-Window Compaction Strategy, since TWCS is specifically designed to purge fully-expired SSTables efficiently.
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...
