开发者

which one is not guaranteed by transactions in a database

开发者 https://www.devze.com 2023-01-29 19:52 出处:网络
All of the changes made to data during a transaction will be permanently stored in database Cha开发者_Go百科nges made to data during the transaction are not visible to other process until the transac
  1. All of the changes made to data during a transaction will be permanently stored in database
  2. Cha开发者_Go百科nges made to data during the transaction are not visible to other process until the transaction completes
  3. Integrity constraints are satisfied once transaction completes
  4. While one process is modifying some data with in a transaction,a second process must wait untill the first completes its transaction


4 is not guaranteed

While in a transaction to modify certain tables, other processes can modify the same tables using their transactions.

EDIT:

I believe other processes will indeed have to wait to update the same tables used by the first process' transaction. Other processes will be allowed to carry out their transactions concurrently as long as they involve other tables (not the tables updated in the first process' transaction). So I would still say option 4 is not guaranteed, because option 4 is too broad.


1 - If it fails half way through, the data changes will be rolled back. Note about #4...The process in the transaction can have a lock on one or a few tables, but that doesn't mean the whole database most of the time. Other processes can hit the tables that aren't locked.


These options are a little broad for my taste, particularly when asking about guarantees. There are problems with several of them:

  1. Item 1 is guaranteed for committed transactions, not ones that are rolled back.
  2. Item 2 can be defeated depending on the DBMS (like SQL Server's SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED), but I suspect this one is valid from a textbook's standpoint.
  3. I will grant that #3 is valid if we don't nitpick things like the ability to disable constraints, though you can argue that the data satisfies general integrity requirements because it satisfies any in-force constraints.
  4. Item 4 is not guaranteed for the reasons given by @byneri and @DaMartyr - unrelated data can still be modified.

If I had to pick one it would be #4, but #1 is tempting as well. It's tough to know what a professor/textbook is looking for after you've in the real world for a number of years.

0

精彩评论

暂无评论...
验证码 换一张
取 消