oracle中dbms
并发 (Concurrency)
The ability of a database system which handles simultaneously or a number of transactions by interleaving parts of the actions or the overlapping this is called concurrency of the system.
数据库系统通过交织部分操作或重叠操作来同时处理或处理大量事务的能力称为系统并发性。
并发优势 (Advantages of concurrency)
The good is to serve many users and provides better throughput by sharing resources.
这样做的好处是可以为许多用户提供服务,并通过共享资源提供更好的吞吐量。
Reduced waiting time response time or turn around time.
减少等待时间的响应时间或周转时间。
Increased throughput or resource utilization
吞吐量或资源利用率提高
If we run only one transaction at a time than the acid property is sufficient but it is possible that when multiple transactions are executed concurrently than database may become inconsistent.
如果我们一次只运行一个事务,那么酸属性就足够了,但是当同时执行多个事务时,数据库可能会变得不一致。
Overlapping with the input-output activity with CPU also makes the response time better.
与CPU的输入输出活动重叠也可以提高响应时间。
But interleaving of instruction between transaction may also lead to many problems due to which concurrency control is required.
但是事务之间的指令交织也可能导致许多问题,由于这些问题需要并发控制。
并发问题 (Problems due to concurrency)
There are many which may occur due to concurrency,
由于并发,可能发生许多情况,
1) Dirty read problem
1)脏读问题
If a transaction reads an uncommitted temporary value written by some other transaction than it is called dirty read problem. In this one transaction read a data item updated by another uncommitted transaction that may be future be aborted or failed. In such cases, the read value disappears from the database upon abort this is turned on dirty read the reading transaction end with incorrect results.
如果一个事务读取了由其他事务写入的未提交的临时值,则称为脏读取问题。 在此事务中,读取由另一个未提交的事务更新的数据项,该数据项将来可能会中止或失败。 在这种情况下,读取值在中止时会从数据库中消失,这将导致脏读取中的读取事务结束,并且结果不正确。
Example
例
T1 T2
R(A)
W(A)
R(A)
The values of item x which is read by T2 is called dirty read data because this data can be created by a transactions that has not been committed yet.
T2读取的项x的值称为脏读取数据,因为该数据可以由尚未提交的事务创建。
2) Loss update problem/ write - write problem
2)丢失更新问题/写-写问题
This problem occur when two transactions access the same data item and have their operations interleaved in a way that makes the value of some database items incorrect.
当两个事务访问相同的数据项并以某种使某些数据库项的值不正确的方式交错操作时,会发生此问题。
If there are two write operations of the different transaction on some data values and in between them there are no read operations then the second write over the first .consider the schedule below,
如果不同事务在某些数据值上有两次写操作,并且在它们之间没有读操作,则在第一个上进行第二次写操作。请考虑以下时间表,
Example
例
T1 T2
R(A)
W(A)
W(A)
Here is a blind write that means write without a read. Here the changes made by transaction T1 are lost which is updated by a transaction T2.
这是盲写,表示写而没有读。 此处,事务T1所做的更改会丢失,而事务T2会对其进行更新。
3) Unrepeatable and phantom read problem
3)不可重复的幻像读取问题
When a transaction cannot repeat the read instructions because the variable is deleted by some other transaction then this problem is called phantom read problem. In this problem at different instances of time a transaction read gives different values it is because data item might have been updated by another transaction.
当某个事务由于该变量被其他事务删除而无法重复读取指令时,此问题称为幻像读取问题。 在此问题中,在不同的时间实例下,事务读取给出不同的值是因为数据项可能已被另一个事务更新。
This causes a problem while execution of some aggregate by a transaction and due to changes in the values of the data item by another transaction it leads to incorrect results. When a transaction read values of data item twice and another transaction's updates data item in between then the results of two read operations will differ.
这在事务执行某些聚合时会引起问题,并且由于另一事务在数据项的值更改中会导致错误的结果。 当一个事务两次读取数据项的值,而在两次事务之间更新另一个数据项的更新时,两次读取操作的结果将有所不同。
Example
例
T1 T2
R(A)
R(A)
Delete(A)
R(A)
4) Incorrect summary problem
4)错误的汇总问题
When one of the transactions is checking on aggregate summary function while other transactions are updating then this problem is called incorrect summary problem. The aggregate functions may calculate some values before they updated and others after they are updated.
当其中一个事务正在检查汇总摘要功能而其他事务正在更新时,此问题称为不正确的摘要问题。 聚合函数可以在更新之前计算某些值,而在更新之后计算其他值。
时间表 (Schedule)
A schedule contains two or more transaction or one after another. All the instructions of each individual transaction will appear in the schedule contact switching can be done but we cannot change the order of execution.
时间表包含两个或多个事务或一个接一个。 每个交易的所有指令都将出现在时间表中,可以进行联系切换,但是我们不能更改执行顺序。
时间表类型 (Types of schedule )
Schedule can be classified into mainly two types,
时间表主要可以分为两种类型,
Serial schedule
序列时间表
if the schedule runs only one transaction at a time and can start other transaction after computing the first than it is called serial schedule. If there are n schedules than ! n different schedules are possible.
如果计划一次仅运行一个事务,并且可以在计算第一个事务之后启动另一个事务,则称为串行计划。 如果有n个时间表,则比! n可能有不同的时间表。
Non-serial/concurrent schedule
非连续/并发时间表
A schedule is said to be non-serial schedule if we start executing other transactions before computing the first one. A schedule in which sequence of instructions of transactions appear in the same order as they appear in individual transactions but the instructions may be interleaved with the instructions of different transactions i.e. concurrent execution of transaction takes place.
如果我们在计算第一个事务之前开始执行其他事务,则该调度被称为非串行调度。 一种时间表,在该时间表中,交易的指令序列以与在单个交易中出现的顺序相同的顺序出现,但是指令可以与不同交易的指令交错,即发生交易的同时执行。
翻译自: https://www.includehelp.com/dbms/concurrency-and-problem-due-to-concurrency.aspx
oracle中dbms