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
Join Types
- Nested Loop - Merge Scan Join - Hash Join - Bitmapped Join
26
Nested Loop Use Cases
Small inner table (<10^3) + Big outer table
27
Merge Scan Use Cases
Requires sorting. Useful when we have a previous or following sort operation.
28
Hash Join
Useful for large DS
29
Bitmapped Join
Useful for joining multiple tables into a big central table.
30
Group By Types
- Sort Based: GB sort, GB no sort - Hash Based: GB hash, GB no hash
31
Selectivity
Fractions of rows selected from the original dataset
32
Cardinality
Number of rows
33
Optimization Exercise Steps
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
Big / Small table threshold
10^3
35
Good / Bad selectivity threshold
1/10
36
Full Table Scans Use Cases
- No index - Retrieval of large portion of the original table - Full table + Filter
37
Index Scan Types
- 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
Bitmap Indexes Use Cases
For queries containing multiple WHERE clauses
39
RowID Scan Use Cases
Retrieving a single row
40
Serial Schedule
The actions of each transaction appear in sequence (T0 -> T1 -> T2)
41
Schedule Equivalence Types
- View Equivalence - Conflict Equivalence - 2 phase locking - Timestamp equivalence
42
Serializable Schedule
Schedule that is equivalent to an arbitrary SERIAL schedule of the same transactions
43
View Equivalence / Serializable
Procedure: 1. Detect read-froms and final writes Equivalence: - Same reads-from set - Same final write set
44
Conflict Equivalent / Serializable
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
2 Phase Locking