Why use slice as immutable memtable type?

Hello everyone, my question is here(badger/db.go at master · dgraph-io/badger · GitHub) why imm is a slice of skiplist instead of one skiplist?

I see here(badger/db.go at master · dgraph-io/badger · GitHub) make sure imm just pick one element every time (edited)

So why not use db.imm = db.mt instead of db.imm = append(db.imm, db.mt) ? (edited)

I see Leveldb use db.imm = db.mt style. (edited)

Sorry for my pool English, I hope you know what I mean…

There is not just one, but many immutable tables, which are waiting to be flushed to disk. That’s why it’s a slice. You can control how many they can be here:

Got it, thanks for reply.