DBMS Flashcards

1
Q

DBMS Architecture

A

SQL commands
|
Optimizer
|
Access method manager
|
Buffer manager — Concurrency control, Reliability Manager
|
Database (Index files, Data files)

— Reliability Manager

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

Optimizer

A

Generates execution strategy for a query

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

Access Method Manager

A

Implements execution strategy by performing physical access to data

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

Buffer Manager

A

Manages page/block transfer from disk to main memory and vice versa

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

Concurrency Control

A

Manages concurrent access to data

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

Reliability Manager

A

Guarantees content correctness after crashes

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

Rollback

A

The database goes back to the state at the beginning of the transaction, before the error

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

Commit

A

Correct end of a transaction

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

ACID properties

A

Atomicity
Consistency
Isolation
Durability

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

Atomicity

A

Transaction must be completed and not left at intermediate states of execution.
- Redo
- Undo

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

Consistency

A

Transaction should not violate integrity constrains enforced by a database schema
- Rollback
- Automatically correct the violation

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

Isolation

A

Transactions must not interfere.
- Concurrency control

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

Durability

A

Data not lost on failures
- Reliability manager

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

Fix primitive

A

Loads pages into the buffer.

If PAGE in buffer:
return Page Address
Else:
If free page available:
Store page in available space
Else:
Search for count=0
if dirty == 0: write on disk
else: store page in that space

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

Force primitive

A

Write ops immediately propagated to disk

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

Flush primitive

A

Write ops postponed until free buffer

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

Heap File

A

New records are inserted at the end. All space is exploited.
Frequent for unclustered (secondary) indices

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

Ordered Sequential Structures

A

Records inserted by sort key. Usually free space is left in every block to add transactions in an ordered way.
Frequent for clustered (primary) indices

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

Primary (clustered) Indices

A
  • Ordered Data structures
  • Only one index of this type can be defined
  • Clustered B Tree Index, Hash Index
20
Q

Secondary (Unclustered) Indices

A
  • Unordered Hash data structures
  • Multiple different indices can be defined
  • B Tree, Bitmap, Hash
21
Q

B Tree Index Use Cases

A

Range Queries

22
Q

Hash Index Use Cases

A

Equality predicates

23
Q

Bitmap Index Use

A

Boolean expressions

24
Q

Access Paths

A
  • Full table scans
  • Index scans
  • RowID scans
25
Q

Join Types

A
  • Nested Loop
  • Merge Scan Join
  • Hash Join
  • Bitmapped Join
26
Q

Nested Loop Use Cases

A

Small inner table (<10^3) + Big outer table

27
Q

Merge Scan Use Cases

A

Requires sorting.
Useful when we have a previous or following sort operation.

28
Q

Hash Join

A

Useful for large DS

29
Q

Bitmapped Join

A

Useful for joining multiple tables into a big central table.

30
Q

Group By Types

A
  • Sort Based: GB sort, GB no sort
  • Hash Based: GB hash, GB no hash
31
Q

Selectivity

A

Fractions of rows selected from the original dataset

32
Q

Cardinality

A

Number of rows

33
Q

Optimization Exercise Steps

A
  1. Writing algebra tree
  2. Compute cardinalities
  3. Select access paths without indexes
  4. Select Join and GB Types
  5. Create Indexes and new access paths
  6. Evaluate possible GB anticipations
34
Q

Big / Small table threshold

A

10^3

35
Q

Good / Bad selectivity threshold

A

1/10

36
Q

Full Table Scans Use Cases

A
  • No index
  • Retrieval of large portion of the original table
  • Full table + Filter
37
Q

Index Scan Types

A
  • Index Unique Scans: Return one rowID. Useful for unique values.
  • Index Range Scans: Data returned in ascending order. Avoid sorting for GB with same attribute.
  • Index Full Scans: Avoids sorting for GB with same attribute.
  • Fast Full Index Scans: Data is not ordered.
  • Bitmap Indexes
38
Q

Bitmap Indexes Use Cases

A

For queries containing multiple WHERE clauses

39
Q

RowID Scan Use Cases

A

Retrieving a single row

40
Q

Serial Schedule

A

The actions of each transaction appear in sequence (T0 -> T1 -> T2)

41
Q

Schedule Equivalence Types

A
  • View Equivalence
  • Conflict Equivalence
  • 2 phase locking
  • Timestamp equivalence
42
Q

Serializable Schedule

A

Schedule that is equivalent to an arbitrary SERIAL schedule of the same transactions

43
Q

View Equivalence / Serializable

A

Procedure:
1. Detect read-froms and final writes

Equivalence:
- Same reads-from set
- Same final write set

44
Q

Conflict Equivalent / Serializable

A

Procedure:
1. Aj(x) is in conflict with Ai(x) if
- (I!=j)
- (x==x)
- RW, WR or WW conflict
- No other W(x) between them

Equivalence:
- Same conflict set
- Each conflict pair is in the same order

Serializable:
1. Create node graph with a node for each transaction
2. Draw arrows for Actions (from first action to last one)
3. If the graph is not cyclic then the schedule is serializable.

45
Q

2 Phase Locking

A