Databases Flashcards

1
Q

What’s a column store for? When is it good?

A

Datawarehousing. When reading only specific columns.

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

What are the big O values of Hash lookup?

A

All O(1) except for inorder traversal which requires a sort.

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

How are indexes implemented?

A

Hash the key, result goes to a bucket in memory.

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

What are the isolation levels of DB transactions?

A

Read uncommitted - no isolation
Read Committed - commits on read if data is uncommitted
repeatable read - trx holds locks on rows
Serializable 0 concurrent trx execute serially

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

What’s better about a B+ tree than a B-?

A

All nodes on one child level,
in order traversal faster

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

What’s the big O of B-tree operations

A

Space = O(N), insert, search, delete = O(logn), traversal = O(n)

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

Describe non-clustered index

A

Data scructure separate from table. B-tree to organized.

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

What do isolation levels help? What are their cons?

A

Pro - data won’t change through the course of your trx. Cons - locking slow things down and cause deadlocks

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

What is pessimistic concurrency control?

A

Data is locked when read to eliminate chance of rollback

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

What does ACId stand for?

A

Atomic, Consistent, Isolation, Durable.

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

When is optimistic concurrency control good?

A

When data is not changed very often (historical records)

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

What’s truncate vs delete?

A

truncate gas an autocommit, frees up memory. Delete does not.

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

What is an aggregation pipeline?

A

For NoSQl, similar to SQL but aggregates all your data?

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

What is the mechanism to aggregate all your NoSQL data with SQL queryish type queries?

A

Aggregation pipeline.

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

What is a Hikari Pool?

A

A connection pool - lets you handle distributed database connections, setting max connection sizes, etc.

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

Why are database connection pools needed for efficiency? 2 Reasons

A
  1. Opening and closing a DB connection is expensive, so optimizing the frequency of this event saves resources.
  2. A connection is ready at each request so the trx doesn’t have to wait for a connection to be made.
17
Q
A