LSM-Tree vs B-Tree — Concept Check
Questions on LSM-Tree vs B-Tree. B-Trees are the default index structure in relational databases, optimised for reads. LSM-Trees (Log-Structured Merge-Trees) are optimised for write-heavy workloads, used in Cassandra, RocksDB, and LevelDB.
Questions in this quiz
8 questions on LSM-Tree vs B-Tree — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A database system is experiencing high write latency. The workload is predominantly write-heavy. Which data structure should be considered to improve performance?
- ALSM-Tree
- BB-Tree
- CBinary Search Tree
- DHash Table
2.A company uses a database with frequent read operations and occasional writes. Which data structure is more suitable for this workload?
- AHeap
- BB-Tree
- CLSM-Tree
- DTrie
3.In an LSM-Tree, what is the main purpose of background compaction?
- ATo convert sequential writes to random writes
- BTo immediately delete old SSTables
- CTo increase the size of the memtable
- DTo merge SSTables and maintain read performance
4.A database using B-Trees is experiencing slow write performance. What is a likely cause?
- ARandom I/O for writes
- BSequential I/O for writes
- CHigh CPU usage during compaction
- DToo many SSTables
5.Which data structure is likely to cause higher write amplification due to compaction processes?
- AB-Tree
- BLSM-Tree
- CHash Table
- DLinked List
6.A developer claims that B-Trees are always better for all database workloads due to their fast read performance. What is a flaw in this reasoning?
- AB-Trees are not suitable for any database workloads
- BB-Trees do not support range queries
- CB-Trees have random I/O for writes, which is not optimal for write-heavy workloads
- DB-Trees require too much memory
7.In an LSM-Tree, what is the role of the memtable?
- ATo handle read operations exclusively
- BTo store the entire database in memory
- CTo buffer writes in memory before flushing to disk
- DTo manage transactions
8.A database system using LSM-Trees is experiencing increased CPU usage. What could be a contributing factor?
- AIncreased read operations
- BRandom I/O operations
- CLow write throughput
- DBackground compaction processes