【COMP207 Final】

1. INSERT : 

INSERT INTO transaction( , , ,) VALUES ( , , , );

2. 

3. Create table :

1. 注意table属性的顺序 例: from_account, to_account

2. 注意table在create的时候要有名字

3. 注意有时候varchar(5)的时候不够大,需要varchar(50)

4. CONSTRAINT primary key and foreign key

1. 注意名字不要搞反了

2. 后面reference的时候要加表格 例:

CONSTRAINT FK_Transactions_From_Account FOREIGN KEY (from_account) REFERENCES Accounts(id)

5. Group by

6.  Relational Algebra

7. ACID properties

4 level of Isolation

A更新的时候B都可以读取

A只有读取时B可以读取更新

A读取时B都只能读取

依次进行 

8. Undo / Redo 

>> Property do we need to ensure both atomicity and durability

UNDO : Force / Steal

REDO : No Force / No Steal 

>> Undo X,Y,Z 值

从下往上看,哪个transaction被commit了就忽略哪个,然后最上面保留的xyz值就是最后的值

9. Cases is it required and sufficient to change the log  when Undo/Redo logging

  1. At the start of a transaction
  2. On committing a transaction
  3. On aborting a transaction
  4. When a transaction writes an item   

10. Shorthand notation of schedule

从上往下,不管是T1还是T2,COMMIT要写c1,c2

11. Shared buffer change

解析:这里T2读到的x是没有被T1更改的,所以还是22,并且他比T1晚write,write就是把值写入buffer的过程,所以最后buffer的值是最后write的值

12. Conflict

13. Strict 

1.  A schedule is strict if each transaction in it reads and writes only values that were written by transactions that have already committed.  就是如果是同一事务,只能read和write已经被commit的

14. Recoverable

1. 如果T2读取了T1的数据,那么T1应该先于T2commit

15. Cascadeless Schedules

1. T1的读 , 写, commit 都在T2的读,写,commit前面,那么就是cascadeless schedule

2. Cascadeless 的 schedule 都是 recoverable的

15. Conflict-Serializability

1. Precedence graph 没有圈

2. 所以没有conflict的肯定是conflict-serializability

16. Strict 2PL (two-phase locking )

1. Conflict-serialisability and Strict schdules

2. Strict 2pl 也可能有deadlock

17. Valid 2PL transaction

1. 第一个unlock之后就不再有lock了不管是什么lock

2. shared lock (s-lock) 后只能是read 不能是write

3. 注意shared lock(x)后的read一定要是read(x),不能是其他

18. Timestamp ( LEC15 )

1. Each transaction T is assigned a unique integer TS(T) upon arrival (the timestamp of T). If T1 arrived earlier than T2, we require TS(T1) < TS(T2)  哪个transaction更早执行,timestamp越小

2. Timestamps for Deadlock Detection里,即使事务restart,timestamp是不变的:

但正常情况下,restart后需要有新的timestamp:

 

3. Read time of X : RT(X):Timestamp of youngest transaction that read X

Write Time of X: WT(X) :Timestamp of youngest transaction that wrote X

4. Read Requests:

If T1 requests to read X: Abort & restart T1 if WT(X) > TS(T1) 

Write Requests:

If T1 requests to write X: Abort & restart T1 if RT(X) > TS(T1) or WT(X) > TS(T1)

5. Starvation can occur (cyclic aborts & restarts of transactions)

6. Multiversion concurrency control

This means that a transaction only need to restart if it tries to write AND the read timestamp is later than your timestamp (同时满足1. write 2. read timestamp RT(X) > TS(T1)

解析:1. 因为这时候他的RT(Y) = 2 > TS(T1) = 1   2. write

 所以Abort and restart

Read(X) 来更新TS = 3,然后再read(Y),write(Y) 这个时候RT = TS = 3,不用Abort and restart

19. wait-for graph 

 T1 指向 T2 意思就是T1在等T2释放锁,一旦有一个cycles,那么就是deadlock

20. Without fragementation transparancy

1. vertical fragments --------  natural join

horizontal fragments -----  union 

2. Which of the transparancies have to do with hiding backups?

Replication transparancy

21. Navigation Axes

解析:author[ancestor::serie] 的意思就是只要在author上面的所有tag name里面,包括有serie,那么就选中他

22. DTD

1. for $x in $.....

2.  有(author,author)这种写法,意思就是有两个作者的意思

23. Processing in DDBS

解析 :cost of communication = |s| * size of s' + |r| * size of r'

这里是求R natural join S, 所以分别是|S|和|R left semijoin S|

 size of 分别是 R的 A+B = 11 和 S的key B = 6

最后计算是 : 11 * 300 + 6 * 400 = 5700

 解析:这里是Passenger去natural join 后面的,所以Passenger是R,flight是S

S‘ 是 第一个1000,R’是 |Passenger semijoin S‘|= 第二个1000,

这里的key是passenger_id, 所以size of S 就是 passenger_id 的30

size of R 就是first_name,last_name和passenger_id的(30+30+30)

最后计算是 : 30*1000 + (30+30+30)*1000 = 12000

24. Checkpoint

1. Simple checkpoint (for undo logging)

因为一旦checkpoint一旦过了,那么checkpoint之前的内容就可以从log(buffer)转移到disk,所以checkpoint可以使log file smaller

同时因为checkpoint使用时periodly,所以不时会有一部分内容到达disk

解析:这道题时ARIES checkpoint,但他有endpoint,然后T1和T2都commit了,所以从T3开始看,也就是第四排的start 

2. ARIES checkpoint (for undo / redo logging)

因为Transactions do not write to buffers(!) before they are sure they want to commit,所以ARIES checkpoint 

ARIES checkpoint 需要有<END CHECKPOINT>,所以如果没有的话就和没有checkpoint一样

 解析:ARIES checkpoint 需要有<END CHECKPOINT>,所以如果没有的话就和没有checkpoint一样

25. wound-wait  wait-die

wait-die : old transaction wait

wound-wait : young transaction wait

26. 

27. serial

 

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值