[Database] Review Miscellaneous

insert image description here
(Illustrator Blue Bird @mo13tto)

Database Notes (Supplementary) - Determination of Candidate Codes

Find the minimum dependency set

The definition, method and example of the minimum functional dependency set Fm

Of course, there is an error in the second half of this article: [Easy to understand] Relational model paradigm decomposition tutorial 3NF and BCNF formulas! Xiaobai can also understand

Candidate codes for database final exam preview, minimum functional dependency set, 3NF decomposition algorithm, judging which paradigm

Database decomposition 3NF

An exercise on relational schemas (seeking candidate codes, minimum dependency set, schema decomposition)

Convert ER Diagram to Relational Model

concurrency control

affairsIs the basic unit of concurrency control

The main techniques of concurrency control:

  • blockade
  • timestamp
  • Optimistic Control
  • Multi-version concurrency control

blockade

Solve the data inconsistency problem caused by concurrent operations

Mainly X lock (exclusive lock) and S lock (read lock)

  • X lock: only this transaction can be added after addingread and writeThe locked data object cannot be added by other transactionsany typethe lock
  • S locks can be read (but not modified) after adding them, and S locks can be added for other transactions at any time.

A data with S locks (when the number of S locks>=1) can only be read until all S locks are released

That is, a data object can only have at most one X lock at the same time.orThere are zero to many S-locks.


The rules that locking should follow are the locking protocol

Level 1 Blocking Protocol: Transaction T is inReviseX lock must be applied to the data R before, untilend of businesswas released.
Secondary Lockdown Protocol: InoneBased on the level-blocking protocol plus transaction T inreadS lock must be added to the data R before,after readingThe S lock can be released.
Level 3 lockdown protocol: inoneBased on the level-blocking protocol plus transaction T inreadS lock must be applied to the data R before, untilend of businesswas released.

Pay attention to the timing of application and release

serializable schedule

This definition is really obscure, what I understand is that for transaction T 1 T_1T1and T 2 T_2T2, which are divided into many steps (such as reading, computing, writing back). Serial scheduling is to execute T 1 T_1 firstT1In execution T 2 T_2T2Or execute T 2 T_2 firstT2and T 1 T_1T1. In short, one transaction runs before another.

However, due to the different order of execution here, the results may be different

Serializable scheduling is to execute a part of a transaction, then execute a part of another transaction, and then come back to execute, and the result is consistent with any result of the original serial scheduling.

insert image description here
I took someone else's picture, you can look at it together.

Non-serializable means that the result is different from serial scheduling. Generally, both operations are S-locked first.same momentThe
initial value, and then finally lead to different operation results

Two-stage lock protocol

You can only apply when you apply, and you can only release when you release

Transactions that follow the two-phase lock protocol may deadlock

Guess you like

Origin blog.csdn.net/qq_39377889/article/details/128361140