Ch12_p1.pdf
Document Details
Uploaded by Deleted User
Full Transcript
- Ch12: - object databases: specify the structure of complex objects - Operations that can be applied to these objects - Object: has both an Immutable object identifier and a state (changeable value) - Literal: has a state (fixed value) but no object identifier - Transient objects: Exist tem...
- Ch12: - object databases: specify the structure of complex objects - Operations that can be applied to these objects - Object: has both an Immutable object identifier and a state (changeable value) - Literal: has a state (fixed value) but no object identifier - Transient objects: Exist temporarily during execution of a program - Disappear once program terminates(e.g. query result) - Persistent objects: Stored permanently in database, persist after program termination o Naming mechanism: unique name - finds object by its name o Reachability: object referenced from other persistent objects; object located through references - Inheritance: Definition of new types based on other predefined types - Leads to type (or class) hierarchy o PERSON: Name, Address, Birth_date, Age, Ssn o STUDENT subtype-of PERSON: Major, Gpa - Extent: A named persistent object to hold collection of all persistent objects for a class. o Every object in an extent that corresponds to a subtype must also be a member of the extent that corresponds to its supertype. - Objects 5 aspects: Identifier – name – lifetime – structure – creation - Behavior inheritance: IS-A or interface inheritance - - Ch17: - Fixed-Length Records: All records in the file have the same size. - Variable-Length Records: Records in the file have different size → use spanned or unspanned - Spanned Organization: Part of a record is stored in one block and the remainder in another. o A pointer at the end of the first block indicates the block containing the rest of the record. o Used when a record exceeds the size of one block. - Unspanned Organization: Records are not allowed to cross block boundaries. o Used with fixed-length records when the block size is greater than the record size - dense index: has an index entry for every search key value in the data file. → secondary - sparse index: has index entries for only some of the search values. → primary-cluster - A secondary index: provides a secondary means of accessing a data file for which some primary access already exists. - Tuning Indexes: reviewing and adjusting database indexes for better performance. Here are the key reasons: o Slow Queries: Some queries may run slowly if there isn't a suitable index. o Unused Indexes: Some indexes might not be used at all, wasting resources. o Frequent Updates: Indexes on frequently changing data may need constant updates, affecting performance. o Tuning Goal (Dynamic Evaluation): Index needs can change over time (seasonally or monthly), so regular assessment is essential to optimize performance. o Creating and Dropping Indexes: While removing and creating indexes can be resource-intensive, it can improve performance. However, this process can temporarily disrupt table updates, which needs to be considered. - - Ch21: - Binary Locks: can have two values: locked and unlocked (1 and 0). - Read-Locked (Share-Locked): multiple transactions are allowed to read the item. o no transaction can write to it until all read locks are released. - Write-Locked (Exclusive-Locked): a single transaction exclusively holds the lock on the item. o no other transaction can read or write to it until the lock is released. - Lock upgrade : A transaction (T) first issues a read_lock(X) to read item X. o It can upgrade to a write_lock(X) if it is the only transaction holding a read lock on X. o If other transactions are reading X, T must wait. - Lock Downgrade: a transaction T issues a write_lock(X) and then later downgrade the lock by issuing a read_lock(X) operation. - A serial schedule: a transaction only starts when the other transaction is finished execution. - Deadlock occurs when each transaction T in a set of two or more transactions is waiting for some item that is locked by some other transaction T′ in the set. o T1 holds a lock on resource A and is waiting for resource B. o T2 holds a lock on resource B and is waiting for resource A - Starvation occurs when a transaction cannot proceed for an indefinite period of time while other transactions in the system continue normally. o lower-priority transaction is always preempted by higher-priority transactions, it may never get the chance to execute. - Choosing a Victim: When a deadlock is detected, one transaction (the "Victim") must be chosen to terminate to break the deadlock. o Avoid Long-Running Transactions: Its generally better to avoid selecting transactions that have been running for a long time or have made many updates. This is because they have likely done significant work. o Select Younger Transactions: Instead, its preferable to select transactions that have not made many changes or have been running for a shorter time (younger transactions). This minimizes the impact on overall system progress.