1. Homepage
  2. Homework
  3. COMP643 Advanced Database Management Assignment 2: Transaction Management and Concurrency Control
This question has been solved

COMP643 Advanced Database Management Assignment 2: Transaction Management and Concurrency Control

Engage in a Conversation
Lincoln UniversityCOMP643Advanced Database ManagementTransaction ManagementConcurrency ControlDatabase Performance TuningQuery OptimisationDatabase Security

Late Penalty: CourseNana.COM

Submission: CourseNana.COM

COMP643 Advanced Database Management Assignment 2 CourseNana.COM

Work not received by the due time incurs an immediate penalty of up to 25% of the marks available. No work will be accepted after Sunday 26th May 2024 5:00 p.m. CourseNana.COM

via COMP643 on LEARN CourseNana.COM

Part 1 Transaction Management and Concurrency Control (60 points) CourseNana.COM

Agri Markets sell products to customers. The relational diagram in Figure 1 represents the main entities for Agri’s database. CourseNana.COM

Figure 1- The Agri Markets Entity Relationship Diagram (ERD) CourseNana.COM

Note the following important characteristics: CourseNana.COM

A customer may make many purchases, each one represented by an invoice.
o The cus_balance is updated with each credit purchase or payment and represents CourseNana.COM

the amount the customer owes.
o The cus_balance is increased (+) with every credit purchased and decreased (-) with CourseNana.COM

every customer payment.
o The date of last purchase (cus_datelstpur) is updated with each new purchase made CourseNana.COM

by the customer.
o The date of the last payment (cus_datelstpmt) is updated with each payment made CourseNana.COM

by the customer. CourseNana.COM

Note: Q1. CourseNana.COM

An invoice represents a set of products purchased by a customer.
o An Invoice can have many invoice lines, one for each product purchased.
o The inv_total represents the total cost of the invoice including taxes.
o The inv_terms can be “30”, “60”, or “90” (representing the number of days of credit) CourseNana.COM

or “cash” or “cheque” or “cc”.
o Theinv_statuscanbe“open”,“paid”or“cancel”. CourseNana.COM

A product’s quantity on hand (p_qtyoh) is updated (decreased) with each product sale. A customer may make many payments. The payment type (pmt_type) can be one of the following: CourseNana.COM

o cash” for cash payments.
o cheque” for cheque payments. o cc” for credit card payments. CourseNana.COM

The payment details (pmt_details) are used to record data about check or credit card payments. CourseNana.COM

o The bank, account number, and cheque number for cheque payments.
o The issuer, credit card number, and expiration date for credit card payments. CourseNana.COM

Not all entities are represented in this example. Use only the attributes indicated.
Using this database, write the SQL code to represent each of the following transactions. Use
CourseNana.COM

BEGIN TRANSACTION to group the SQL statements in logical transactions. (10 points) CourseNana.COM

  1. On 20 Apr 2024, customer 10010 makes a credit purchase (60 days) of two units of product 23109-HB with a unit price of $9.95 and one unit of product WR3-TT3 with a unit price of $119.95. The tax rate is 10%. The invoice number is 20001, and this invoice has two product lines. CourseNana.COM

  2. On 5 May 2024, customer 10010 makes a payment of $100 in cash. The payment ID is 5001. CourseNana.COM

Create a simple transaction log (using the format shown in Lecture 9) to represent the actions and transactions in Q1a. (10 points) CourseNana.COM

Using the two-phase locking protocol, create a chronological list of locking, unlocking and data manipulation activities that would occur during the complete processing of the transaction described in Q1a. (10 points) CourseNana.COM

For the following schedule, assume that the shared locks are requested immediately before each read operation, and exclusive locks are requested before every write operation. Unlocks occur immediately after the COMMIT statement. CourseNana.COM

Step CourseNana.COM

1 2 3 4 5 6 7 8 CourseNana.COM

T1 CourseNana.COM

Read(X) CourseNana.COM

Write(Y) COMMIT CourseNana.COM

T2 CourseNana.COM

Write(Y) Write(X) CourseNana.COM

COMMIT CourseNana.COM

  1. Add lock and unlock requests (using shared/exclusive locks) and explain why this schedule will cause a deadlock. You will need to rewrite the schedule to show the lock and unlock requests. (10 points) CourseNana.COM

  2. Assume that the timestamp for transaction T(i) is i, explain how this deadlock will be handled using wait/die and wound/wait schemes. (10 points) CourseNana.COM

Q5. Given the concurrent transactions shown in Figure 2. At time 9, a crash occurred. CourseNana.COM

Figure 2- Timeline of Concurrent Transactions CourseNana.COM

  1. Describe in detail the database recovery process using the deferred-write technique for each transaction (5 points). CourseNana.COM

  2. Describe in detail the database recovery process using the write-through technique for each transaction (5 points). CourseNana.COM

Part 2 Database Performance Tuning and Query Optimisation (40 points) CourseNana.COM

The following relational database schema is used to keep track of customer orders for roses at Lincoln Rose Farm: CourseNana.COM

Customer (cust_num, cust_name, cust_city, cust_balance) Orders (order_num, cust_num, order_date, order_total) Orderline (line_num, order_num, prod_num, line_qty, line_total) Product (prod_num, prod_desc, prod_price, prod_qoh) CourseNana.COM

The following SQL query is used to select all customers from Christchurch with a balance greater than 0 who have ordered “Ausblush” rose. CourseNana.COM

SELECT cust_name
FROM (((customer
INNER JOIN orders on customer.cust_num = orders.cust_num) inner join orderline on orders.order_num = orderline.order_num) inner join product on orderline.prod_num = product.prod_num) where product.prod_desc = "Ausblush"
and customer.cust_city = "Christchurch"
and customer.cust_balance > 0.00;
CourseNana.COM

Assume: CourseNana.COM

  • There are 10 customers, 10 products, 10 orders, and 22 order lines. CourseNana.COM

  • “Ausblush” has been ordered 7 times. CourseNana.COM

  • There are 6 customers who are based in Christchurch” who has ordered “Ausblush”. CourseNana.COM

  • There are 5 customers who are based in Christchurchand who has a balance greater than CourseNana.COM

    0.00 who has ordered “Ausblush”. CourseNana.COM

  • There is only one product with prod_desc equals to Ausblush. CourseNana.COM

  1. Q1.  Create two alternative access plans and show their respective I/O costs using the example table shown in Week 10 Lecture. (20 points) CourseNana.COM

  2. Q2.  You have been asked to optimise the performance of the query. CourseNana.COM

    1. a)  Identify and describe what indexes should be created and why? (10 points) CourseNana.COM

    2. b)  Revise your access plan and the I/O cost for the selected plan from Q1 assuming the indexes you have identified are applied. (10 points) CourseNana.COM

CourseNana.COM

Part 3 Database Security (20 points) CourseNana.COM

Q1. In Part 2, the database schema is used to process orders for roses. Orders are handled by the sales office. There are currently five staff in this office. Carol, the supervisor, needs to be able to see and update everything. Lim, Jane, and Billy do most of the routine work. They can add, update, and delete orders. They can view existing customers, but they cannot create new customers. Mina is a temporary staff member. She can process orders (add, update, and delete). For customer records, she is only allowed to view the cust_num and cust_name. Large orders above $1000 can only be handled by Carol and Billy. CourseNana.COM

  1. What privileges should be granted to Carol with respect to the four tables? Explain your answer. (6 points) CourseNana.COM

  2. List the privileges should be granted to Lim, Jane, and Billy. (4 points) CourseNana.COM

  3. What privileges should be granted to Mina? (2 points) CourseNana.COM

  4. What additional privileges do you need to grant Carol and Billy so that only these two can handle large orders above $1000. How do you ensure that the rest of the staff are not able to handle large orders? (5 points) CourseNana.COM

  5. What steps do you need to take to ensure that the privileges are set correctly? (3 points) CourseNana.COM

5|Page  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Lincoln University代写,COMP643代写,Advanced Database Management代写,Transaction Management代写,Concurrency Control代写,Database Performance Tuning代写,Query Optimisation代写,Database Security代写,Lincoln University代编,COMP643代编,Advanced Database Management代编,Transaction Management代编,Concurrency Control代编,Database Performance Tuning代编,Query Optimisation代编,Database Security代编,Lincoln University代考,COMP643代考,Advanced Database Management代考,Transaction Management代考,Concurrency Control代考,Database Performance Tuning代考,Query Optimisation代考,Database Security代考,Lincoln Universityhelp,COMP643help,Advanced Database Managementhelp,Transaction Managementhelp,Concurrency Controlhelp,Database Performance Tuninghelp,Query Optimisationhelp,Database Securityhelp,Lincoln University作业代写,COMP643作业代写,Advanced Database Management作业代写,Transaction Management作业代写,Concurrency Control作业代写,Database Performance Tuning作业代写,Query Optimisation作业代写,Database Security作业代写,Lincoln University编程代写,COMP643编程代写,Advanced Database Management编程代写,Transaction Management编程代写,Concurrency Control编程代写,Database Performance Tuning编程代写,Query Optimisation编程代写,Database Security编程代写,Lincoln Universityprogramming help,COMP643programming help,Advanced Database Managementprogramming help,Transaction Managementprogramming help,Concurrency Controlprogramming help,Database Performance Tuningprogramming help,Query Optimisationprogramming help,Database Securityprogramming help,Lincoln Universityassignment help,COMP643assignment help,Advanced Database Managementassignment help,Transaction Managementassignment help,Concurrency Controlassignment help,Database Performance Tuningassignment help,Query Optimisationassignment help,Database Securityassignment help,Lincoln Universitysolution,COMP643solution,Advanced Database Managementsolution,Transaction Managementsolution,Concurrency Controlsolution,Database Performance Tuningsolution,Query Optimisationsolution,Database Securitysolution,