L1 Flashcards

(17 cards)

1
Q

DB interface

A

Interface

  • remove low level concerns from app developer
  • provide additional functional not inherent in underlying resource
  • implementations can be changed over time
  • BUT not always consistent with maximising performance
  • Hourglass (multiple electricity using devices, multiple generation methods, but a single AC mains socket interface for all of these).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

DBMS

A
  1. The interface presented by a database is defined by the query language it uses, its data model, and the programming API>
  2. The query engine implements and knows about the low level representation of data, and thereby can optimise query evaluation.
  3. Services provided by DBMS - abstraction of persistent storage that provides for CRUD operations, ACID transactions.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

CRUD operations

A

Create - insert new items into the DB
Read - query the database
Update - change objects in the DB
Delete - remove data

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

ACID transactions

A

Atomicity, consistency, isolation, durability

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

Atomicity

A

Atomicity - transaction is all or nothing, even under system crash. All actions of t occur or none of them.

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

Consistency

A
  • complete transactions can only transform the state of the DB between consistent states.
    • if a transaction is applied to a consistent state of the DB, it can only leave the DB in a consistent state.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Isolation

A

concurrent transactions must produce a final state corresponding to the result produced by some sequential execution of the transactions. IE the effects of concurrently running transactions are protected from the effects of other concurrently executed transactions.

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

Durability

A
  • if a transaction commits / completes successfully then its effects persist.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Relational model

A
1 Data stored as tables 
2 unique keys identify unique rows
3 attributes correspond to columns 
4 some attributes may be keys into other tables -- abstract pointers to a row in another table. 
5 SQL main query language
6 Purpose is reducing data redundancy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Graph oriented model

A

Data stored as nodes/edges

Query language involves path oriented constructs

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

Document oriented model

A
  1. read optimised

2. key -> value = JSON bytes, for example.

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

Redundant data

A

Data is REDUNDANT if it could be deleted and then re-computed from the rest of the remaining data.

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

Advantage of low DR

A

Low DR -> transaction has to lock fewer tables on average -> more transactions can proceed concurrently -> higher update throughput

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

QL and UT define

A

Query response vs update throughput
Query response: latency until results of query are available.
Update throughput = number of updates committed per unit time.

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

Disadvantage of high DR

A

High DR -> transaction needs to lock other data which is affected by the update, as redundant data items need to be recomputed.

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

Disadvantage of low DR

A

Low DR -> simple queries can be expensive and may need to recompute much data, we a read-optimised DBMS would have cached (which is by definition redundant - the data was originally computed by a query).

17
Q

What to use for a read oriented DB

A

For applications which require read optimised DB - use document oriented model.

  1. Present key , get a blob of JSON bytes.
  2. The JSON bytes contain all the information in the DB about that person.