In-Memory Indexes Flashcards

(18 cards)

1
Q

What differentiates T-Trees from Binary Trees?

A
  • each node holds a set of keys and two pointers to child nodes
  • every tree node has associated a min and max key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Cache Locality?

A

Programs tend to use data with addresses near or equal to those they have used recently

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Temporal Locality

A

Recently referenced items are likely to be referenced again in the near future

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Spatial Locality

A

Items with nearby addresses tend to be referenced close together in time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How is the cache organized?

A
  • in cache lines (typically 64 Bytes)
  • only load / evict full cache lines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Next-Line Prefetching

A

Read a, fetch a+1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Stream Prefetching

A

read a, a+1, fetch a+2, a+3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

2 Tricks to improve cache friendlyness

A
  • sequential access
  • squeeze more useful data into a cacheline
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What differentiates a CSS-Tree from a B+ Tree?

A
  • fit each node into a cache line
  • nodes are filled 100% with data
  • eliminates all child pointers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Physical Representation of CSS Tree?

A
  • contiguous array of nodes
  • contiguous array of sorted data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Idea of CSB+ Tree

A
  • nodes use one pointer to all children
  • child nodes are stored in a node group
  • node group pre-allocates space for inserts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Advantage of Locks

A

Guarantees isolation at tx level

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Advantage of Latch

A

Protects critical section of the internal data structure from other threads

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Latches on B+Trees

A
  • acquire and release is needed when traversing the tree
  • a thread can release a latch on parent node if its child node is considered safe
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When is a B+ Node considered safe?

A

if it won’t split or merge on an update / delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How to latch for B+ Search?

A
  • acquire R latch on node and search node
  • acquire R latch on child
  • when child is latched, unlatch parent node
17
Q

How to latch for B+ Insert / Delete?

A
  • acquire W latch on node and search node
  • acquire W latch on child
  • once child is latched, check if it is safe
  • if yes, release all locks on all ancestors