ระดับการแยก, เซฟพอยต์, และการย้อนกลับ

Transactions and Error Handling in PostgreSQL

Jason Myers

Instructor

ระดับการแยก (Isolation Levels)

ระดับการแยก Dirty Read Nonrepeatable Read Phantom Read Serialization Anomaly
Read Uncommitted Protected (PostgreSQL) vulnerable vulnerable vulnerable
Read Committed Protected vulnerable vulnerable vulnerable
Repeatable Read Protected Protected Protected (PostgreSQL) vulnerable
Serializable Protected Protected Protected Protected
Transactions and Error Handling in PostgreSQL

Repeatable Read

  • SERIALIZABLE

    • จำลองการรันธุรกรรมแบบลำดับเดียวสำหรับทุกธุรกรรมที่ commit แล้ว
  • REPEATABLE READ

    • มองเห็นข้อมูล
      • ที่ commit ก่อนธุรกรรมจะเริ่ม
      • ที่เป็นผลลัพธ์จากคำสั่งก่อนหน้าในธุรกรรมเดียวกัน
    • ไม่มองเห็นการเปลี่ยนแปลงที่ commit โดยธุรกรรมอื่นที่รันพร้อมกัน
Transactions and Error Handling in PostgreSQL

การแสดงภาพ REPEATABLE READ

แผนภาพ REPEATABLE READ

Transactions and Error Handling in PostgreSQL

การแสดงภาพ REPEATABLE READ

แผนภาพ REPEATABLE READ

Transactions and Error Handling in PostgreSQL

การแสดงภาพ REPEATABLE READ

แผนภาพ REPEATABLE READ

Transactions and Error Handling in PostgreSQL

REPEATABLE READ

START TRANSACTION ISOLATION LEVEL REPEATABLE READ;

UPDATE inventory SET quantity = quantity - 4 WHERE name = 'macaron'; SAVEPOINT first;
UPDATE inventory SET quantity = quantity - 12 SAVEPOINT second; COMMIT;
Transactions and Error Handling in PostgreSQL

มาฝึกกันเถอะ!

Transactions and Error Handling in PostgreSQL

Preparing Video For Download...