Chapter 1 - Architecture Flashcards

1
Q

Storage engine architecture

A

Server tasks and query processing is separated from data storage and retrieval

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

Architecture logical view

A

Connection, authentication, security
Query parsing, optimization, caching, procedures, triggers, views
Storage engine API

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

Threads per connection

A

One

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

Threads creation

A

Threads are cached, also thread pooling plugins are allowed

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

Authentication

A

Username, host, password or SSL

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

Query execution

A

Creating parse tree, then applying optimisations like rewriting query, determining table reading order, choosing indexes.

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

Query cache

A

Depends on hash comparison. Is called before pursuing the query

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

Locks

A

Read and write. Write blocks both reading and writing. Read are mutually non blocking. Write has higher priority, they can advance over read locks.

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

Lock performance

A

They have overhead. Storage engine have their own locking policies

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

Table lock

A

When writing whole table is locked. Used for alter table.

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

Row locks

A

Provides best concurrency and biggest overhead. Implemented on the level of storage engines.

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

ACID

A

Atomicity
Consistency
Isolation
Durability

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

Atomicity

A

Indivisible unit of work. All or nothing.

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

Consistency

A

Moving from one consistent state to another

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

Isolation

A

Invisible to other transactions

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

Durability

A

Committed changes are permanent

17
Q

Read uncommitted

A

Transactions can view results of uncommitted transactions.

18
Q

Dirty read

A

Reading uncommitted data

19
Q

Read committed

A

Transactions see only committed data.

20
Q

Non repeatable read

A

Running same statement twice with different results

21
Q

Repeatable read

A

Guarantees that rows look the same every time they are read in single transaction.

22
Q

Phantom reads

A

Selecting range of data when another transaction just added something in that range. Two reads can result in different contents.

23
Q

Serializable

A

Transactions are forced to be ordered

24
Q

How we can replace transaction with lock table

A

?

25
Q

Deadlocks

A

Two or more transactions are holding and requesting lock on the same resource. They create cycle of dependencies.

26
Q

InnoDB deadlock handling

A

In case of circular dependencies it returns error.

In other cases rollbacks transaction with fewest exclusive locks.

27
Q

Transaction logging

A

Storage engine first changes in memory representation of data. Then wires it to transaction log in HDD. The last one is fast because it is sequential I/O operation. Later disk is updated according to that log.

28
Q

Autocommit

A

Each query is executed in transaction by default. DDL usually commits the transaction.

29
Q

MVCC

A

Allow skipping locks and has lower overhead then normal locking strategies.
It keeps snapshot of data as it was at some point in time.
InnoDB for this purpose stores data in two additional columns. One of them is version number which is incremented on every transaction.

30
Q

InnoDB data storing

A

In one or more files known as table space. It is black box managed by engine

31
Q

Next key locking

A

Prevents phantom reads. It not only locks only the needed rows but also the gaps in index structure.