DS L9 Flashcards
(23 cards)
What is a database transaction?
A logical unit of database operations which are executed as a whole for retrieving data or updating the database.
Examples include borrowing or reserving a book.
What is the purpose of transaction management?
To ensure that all updates to the database are completed successfully or none at all, maintaining data integrity.
This is achieved through a transaction log.
What are the four properties of transactions known as ACID?
- Atomicity
- Consistency
- Isolation
- Durability
These properties ensure reliable processing of database transactions.
What is atomicity in the context of transactions?
Ensures that all operations within the work unit are completed successfully; otherwise, the transaction is aborted, and previous operations are rolled back.
This is crucial for maintaining the integrity of the database.
What does consistency ensure in transactions?
Any transaction brings the database from one valid state to another, ensuring data validity according to defined rules.
This includes referential integrity constraints.
What is isolation in transactions?
Enables transactions to operate independently and transparently of each other, supporting concurrent database use.
This prevents interference between transactions.
What does durability guarantee in a transaction?
Ensures that the result of a committed transaction persists in case of a system failure.
This means once a transaction is committed, it remains so even if a crash occurs.
What is a transaction log?
A record that keeps track of all transactions that update the database, storing the pre-image of records to be updated.
This log facilitates rollback in case of abnormal terminations.
What is the rollback process?
A process triggered to restore an inconsistent database to its original state using the pre-image in case of abnormal termination of a transaction.
This occurs when there is a power failure or other interruptions.
What SQL command is used to start a transaction in MySQL?
START TRANSACTION or BEGIN.
This command is necessary to initiate a transaction before executing any SQL operations.
What is concurrency control?
A mechanism that manages simultaneous operations without conflicting, ensuring database integrity.
It is essential in multi-user database environments.
What are the two major types of concurrency control?
- Pessimistic concurrency control
- Optimistic concurrency control
Each type has its own method of handling data access and conflicts.
What is pessimistic concurrency control?
A method that locks records before updates, preventing other transactions from accessing the same data simultaneously.
This approach can limit concurrency but ensures data consistency.
What is optimistic concurrency control?
A method where records are not locked, and updates are validated through a versioning mechanism.
It allows higher concurrency but requires additional checks.
What is a deadlock?
A situation where two or more transactions are waiting indefinitely for resources locked by each other.
Deadlocks can severely affect database performance.
What are the four conditions for deadlock?
- Non-sharable resources
- No preemption
- Multiple independent requests
- Circularity in the graph of requests
These conditions must exist simultaneously for a deadlock to occur.
What is the role of the Personal Data (Privacy) Ordinance of Hong Kong?
It outlines principles for the ethical use and protection of personal data collected from individuals.
The ordinance includes six key principles.
What are the six data protection principles outlined in the Personal Data (Privacy) Ordinance?
- Purpose and manner of collection
- Accuracy and duration of retention
- Use of personal data
- Security of personal data
- Information to be generally available
- Access to personal data
These principles guide data users in handling personal data responsibly.
What is access control in the context of data privacy?
A mechanism that restricts user access to only necessary data to prevent unauthorized access.
It involves granting specific privileges for database operations.
What is the main concern of data privacy?
The protection of identifiable information of individuals or organizations when collected and stored.
Ethical use and prevention of unauthorized access are critical aspects.
True or False: MyISAM storage engine in MySQL supports transaction management.
False.
The InnoDB and BDB storage engines support transaction management.
What is the main difference between pessimistic and optimistic concurrency control?
Pessimistic concurrency control uses locks, while optimistic concurrency control does not lock records but checks version numbers for updates.
This leads to different performance and scalability outcomes.
Fill in the blank: Data privacy is concerned about the _______ of identifiable information.
[protection]
This includes both personal and organizational data.