Database / ScyllaDB Interview questions
When should you use a local secondary index versus a global one?
A local secondary index is stored on the same node as the base data it indexes, so a query using it can only be efficiently satisfied by first knowing (or scanning across) the partition, making it most useful when the query already includes the partition key alongside the indexed column. A global secondary index (as used in Alternator/DynamoDB-style tables) is maintained as its own independently partitioned table, letting you query by the indexed column without knowing the base table's partition key at all, at the cost of extra write overhead to keep it in sync.
Use a local index when filtering within a partition you can already identify, since it avoids the overhead of a separate global structure. Reach for a global index when the access pattern genuinely needs to search across all partitions by an attribute unrelated to the partition key, accepting the additional write cost and (for materialized-view-style implementations) eventual consistency between the base table and the index.
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...
