Concurrency issues
Because many users access and change data in a relational database, the database manager must allow users to make these changes while ensuring that data integrity is preserved.
- Lost updates. Two applications, A and B, might both read the same row and calculate new values for one of the columns based on the data that these applications read. If A updates the row and then B also updates the row, A's update lost.
- Access to uncommitted data. Application A might update a value, and B might read that value before it is committed. Then, if A backs out of that update, the calculations performed by B might be based on invalid data.
- Non-repeatable reads. Application A might read a row before processing other requests. In the meantime, B modifies or deletes the row and commits the change. Later, if A attempts to read the original row again, it sees the modified row or discovers that the original row has been deleted.
- Phantom reads. Application A might execute a query that
reads a set of rows based on some search criterion. Application B
inserts new data or updates existing data that would satisfy application
A's query. Application A executes its query again, within the same
unit of work, and some additional (
phantom
) values are returned.
Concurrency is not an issue for global temporary tables, because they are available only to the application that declares or creates them.
Concurrency control in federated database systems
A federated database system supports applications and users submitting SQL statements that reference two or more database management systems (DBMSs) in a single statement. To reference such data sources (each consisting of a DBMS and data), the Db2® server uses nicknames. Nicknames are aliases for objects in other DBMSs. In a federated system, the Db2 server relies on the concurrency control protocols of the database manager that hosts the requested data.
A Db2 federated system provides location transparency for database objects. For example, if information about tables and views is moved, references to that information (through nicknames) can be updated without changing the applications that request this information. When an application accesses data through nicknames, the Db2 server relies on concurrency control protocols at the data source to ensure that isolation levels are enforced. Although the Db2 server tries to match the isolation level that is requested at the data source with a logical equivalent, results can vary, depending on data source capabilities.