Functions of database management systems (DBMS)
- What are the main functions of the DBMS?
- What does it mean to directly manage data in external memory?
- What is the management of the memory buffers?
- What is a transaction? What does transaction management mean?
- Why does it need to manage transactions in the database?
- What is serialization and a serial transaction plan?
- What happens if two transactions want to access the same database object?
- What is logging in the database?
- What are the requirements for saving the database change log?
- What is the Write Ahead Log (WAL)?
- What is a local transaction log? What is the difference between a local transaction log and a systemwide one?
- What main steps of the DBMS to restore the database with a “soft” failure?
- What main steps are executed to restore a database when “hard failure” is occured?
- What is the redundancy of the data in the database?
- What does the support function for database languages represent?
1. What are the main functions of the DBMS?
The main functions that are performed by database management systems include:
- direct management of data in the external memory;
- management of memory buffers;
- transaction management;
- keeping a log or protocol of the executed operations in the database;
- support for database languages.
2. What does it mean to directly manage data in external memory?
As is known, in order to preserve data and work with them, permanent data storage devices (storage media), for example hard disks, must be available in the database.
- Information carriers are needed in two cases:
- to save the immediate data of the database;
- for official purposes. For example, to provide quick access to data using indexes.
As a rule, the database management system uses its own mechanism for working with external memory devices (external storage devices). For any DBMS, the work with the file system of any other external memory device is important. The user should not think about the features of the DBMS at the lower level.
To provide direct data management in external memory, modern DBMS:
- have their own object naming system;
- can use the capabilities of existing file systems (storage devices);
- can use low-level operations when working with external storage devices.
3. What is the management of the memory buffers?
One of the important characteristics of a database management system is the speed of processing information in the database. The speed of processing information depends on the size of the database.
To increase user interaction with the database, the so-called buffering of data in the RAM is used. For this purpose, a buffer (cache) is created in the RAM with the data that is currently being used. And the information is exchanged through this buffer. Since the read speed of the memory is much higher reading speed of external memory devices, thereby increasing the speed of operation is ensured.
4. What is a transaction? What does transaction management mean?
When working with any database, a relatively infinite sequence of operations is performed. If the sequence of operations is integrated into a single whole (in terms of the DBMS), then this sequence is called a transaction.
In this case, the successful execution of the transaction is important. If the transaction succeeds, the database management system captures all data changes using the COMMIT statement. Changes are recorded in the external memory.
If at least one of the transactions fails, the transaction is considered to be unsuccessful. In this case, a transaction is rolled back (ROLLBACK). When the transaction is rolled back, the database returns to the state that was before the transaction started.
5. Why does it need to manage transactions in the database?
Transaction support is an important condition for the logical integrity of the database. This applies to single-user and multi-user DBMS.
The task of the transaction mechanism is to influence the user in such a way that he feels himself to be a single user of the DBMS. Even if a large number of users work with the DBMS in parallel. In fact, the transaction is a unit of user activity on the database.
6. What is serialization and a serial transaction plan?
Transaction serialization is necessary for parallel executing of transactions. It is used in multi-user databases. Serialization of transactions is: planning the operation of parallel transactions in such a way that, these transactions are executed sequentially one after another.
To ensure serialization of transactions builds a serial transaction plan. Ideally, with a good serial transaction plan, the user will not feel the presence of other transactions in the database. Perhaps only a slight slowdown of the database.
Figure 1. Example of transaction serialization in the case of three users
7. What happens if two transactions want to access the same database object?
This situation has a conflict and can occur in a multi-user database. In this case, one of the transactions is rolled back (ROLLBACK). This is necessary to ensure serialization in the database.
8. What is logging in the database?
Logging is needed to restore the last coherent state of the database after a hardware or software failure. Logging is necessary to ensure the reliability of storing data in external memory.
Hardware failures result from:
- the instantaneous shutdown of the computer (for example, power off). Such hardware failure is also called a “soft” failure;
- they arise due to loss of data on the external storage media. This type of failure is called “hard failure”.
Software failures – are usually an errors in the same programs. Software failures can occur both in user programs and in the DBMS itself. Logging serves as additional information that facilitates the restoration of information in the database.
9. What are the requirements for saving the database change log?
The change log in the database must be securely protected. The change log is not available to DBMS users. Often two copies of the change log are maintained, which are placed on different media.
10. What is the Write Ahead Log (WAL)?
The Write Ahead Log (WAL) strategy is a kind of protocol that works by the following principle: before changing the database object, you must first create an entry in the log about the change of this object.
If you adhere to this strategy, after any failure, you can restore the database using the log, because the record of changes to the database will be generated before the change of the object begins.
11. What is a local transaction log? What is the difference between a local transaction log and a systemwide one?
The local transaction log displays the database modification operations performed in this (specific) transaction. The maintenance of such a journal is the simplest case for restoring a database in the event of failures. To restore a database after a failure, it is enough to roll back the transaction by performing the transaction operations in reverse order (from the beginning to the end) that are recorded in the local log.
Maintaining a local transaction log is supported in some DBMSs. A system-wide log differs from a local transaction log in that it describes transactions performed by all transactions, not just a particular transaction. In a system-wide log, records that correspond to a single transaction are linked to each other using a list. In the event of a failure, all transactions of the specified transaction are restored in the reverse order (from the end to the beginning).
12. What are the main steps of the DBMS to restore the database with a “soft” failure?
“Soft failure” is the case when an instantaneous shutdown of the computer occurred. Examples of “soft” failures:
- the power off of the computer (hardware failure);
- failures in the operating system;
- the errors of programs that interact with the database.
With a “soft” failure may be missing:
- the objects, which have been modified transaction, but the transaction has not been completed at the time of failure (modified objects of uncommitted transactions);
- objects that were placed in the RAM buffer at the time of the crash and which were modified by the completed transactions. These objects, as a result of the failure, had not yet been saved on external storage media, and disappeared without a trace. As you know, the information from the main memory disappears without a trace when the power is turned off.
After a “soft” failure, the DBMS performs the following basic steps:
- rollback of uncommitted transactions;
- the transactions of completed transactions, that have not yet fixed in the external memory, are recreated (they disappeared completely from the RAM buffer).
13. What main steps are executed to restore a database when “hard failure” is occured?
A “hard failure” is characterized by loss of information on external memory media.
In this case, to restore the database use:
- transaction log;
- a backup copy of the database. A backup copy of the database is a complete copy of the database that was made at some point in the logging. If an backup of the database is successfully created, at the moment, the previous operations in the log are fixed and a new log entry starts from this position. Important here is the availability of the logging itself.
14. What is the redundancy of the data in the database?
Redundancy of data in the database is when other information is stored in the database besides the data itself. This information is used by the database management system.
For example. To ensure reliability in the database, a database change log is maintained. To save the journal itself, you also need a place on external media. Thus, the database, besides the most data, also stores other information (log, links between tables, indexing, etc.). This is the redundancy of the data.
15. What does the support function for database languages represent?
Any DBMS must support database languages. This means that special languages must be used to work with data in the database. These languages are called database languages (for example, SQL, MDX, SPARQL, FoxPro, PL / Perl, etc.).
For modern databases basically two languages are distinguished:
- Schema Definition Language, SDL. This language is used to determine the logical structure of the database;
- Data Manipulation Language, DML. This language contains a set of data manipulation operators (adding, deleting and modifying data) and retrieving data from the database.
For modern relational databases, the standard language of use is the SQL language (Stuctured Query Language). This language allows you to define the data schema and manipulate this data.
- General information about databases. History of the development of Database Management Systems (DBMS)
- Basic concepts of the relational data model
- Relational databases. The concept of a key. Types of keys. Relations. Master table and detail table