• Keine Ergebnisse gefunden

Concurrency Tuning Database Tuning

N/A
N/A
Protected

Academic year: 2022

Aktie "Concurrency Tuning Database Tuning"

Copied!
3
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Assignment 6

Concurrency Tuning

Database Tuning

Due date: June 5, 2020 Grading: 5 points

Notes

• It is suggested that you also have a look at the report template before you start working on the assignment.

Access Parameters for PostgreSQL

• Host: biber.cosy.sbg.ac.at

• Port: 5432

• Database: dbtuning_ss2020

• User/Password: you should have received them via email

The database server (biber.cosy.sbg.ac.at) is accessible only from within the univer- sity network. If you would like to work from home, please connect tofanny.cosy.sbg.ac.at via ssh. Java, the PostgreSQL client, and Python are installed on this machine.

Support

If there are any ambiguities or problems of understanding regarding the assignment, you have the following possibilities to clarify them:

• Upon request via email (martin.schaeler@kit.edu)

In this assignment you will explore the concurrency control features of PostgreSQL.

A company with 100 employees pays the salaries at the end of the month. The account of the company (account number 0, initial balance 100) and the accounts of all employees (account numbers 1 to 100, initial balance 0) are with the same bank. The payment transactions should run concurrently. Here are two approaches to solve the problem:

(a) For each employee 1≤i≤100 run the following transaction:

e←SELECT balance FROM Accounts WHERE account=i UPDATE Accounts SET balance=e+ 1WHERE account=i c←SELECT balance FROM Accounts WHERE account=0 UPDATE Accounts SET balance=c−1WHERE account=0

1

(2)

(b) For each employee 1≤i≤100 run the following transaction:

UPDATE Accounts SET balance=balance+1 WHERE account=i UPDATE Accounts SET balance=balance-1 WHERE account=0

Solution (a)

Run solution (a) with isolation level READ COMMITTED. Compare throughput and cor- rectness for different numbers of concurrent transactions, ranging from 1 to 5. The correctness is defined as (c1−c2)/100, where c1 and c2 are the balances of account 0 before and after running all transactions, respectively. Repeat the experiment with isolation level SERIALIZABLE.

Note: If a query is rolled back, restart it until it commits. Java and Python template code is provided in account.zip.

Solution (b)

Run solution (b) with isolation level READ COMMITTED. Compare throughput and cor- rectness for different numbers of concurrent transactions, ranging from 1 to 5. The correctness is defined as (c1−c2)/100, where c1 and c2 are the balances of account 0 before and after running all transactions, respectively. Repeat the experiment with isolation level SERIALIZABLE.

Discussion

Discuss the outcome and explain the difference between the isolation levels in Post- greSQL with respect to your experiment. The following information sources might be useful:

• Lecture notes:

https://dbresearch.uni-salzburg.at/teaching/2018ss/dbt/dbt_04-handout-1x1.pdf

• PostgreSQL documentation:

https://www.postgresql.org/docs/9.6/static/transaction-iso.html

Report

1./2. Give throughput and correctness for both solutions, (a)/(b), with serialization level READ COMMITTEDand SERIALIZABLE, respectively.

3. Discuss the outcomes and explain the difference between the isolation levels in PostgreSQL with respect to your experiment. In own words: Explain how Post- greSQL deals with updates in different isolation levels, within a transaction and within a single SQL command.

2

(3)

Please indicate the average time per group member that was spent solving this assign- ment. The time that you indicate will haveno impact on your grade.

Grading scheme:

Category Max. Points

Description of your setup 0.5

Execution of experiments (Solution (a) and (b)) 1.5

Discussion of results 1.5

Isolation level discussion 1.5

Reminder:Additional questions about the involved topics/techniques will be asked during the meeting.

Important:If the grading scheme is unclear, ask the instructor!

3

Referenzen

ÄHNLICHE DOKUMENTE

long transaction (summation of account balances) multiple short transactions (debit/credit transfers) parameter: number of concurrent transactions. SQL Server 7, DB2 v7.1 and Oracle

free list: list of unused database buffer pages a thread that needs a free page locks the free list during the lock no other thread can get a free page Solution: Logical

Task 1: Implement the straightforward approach to load auth.tsv to the database (PostgreSQL, Java).. Task 2: The straightforward approach

(a) What join strategies does the system propose (i) without use of an index, (ii) with a unique non-clustering index on Publ.pubID, and (iii) with two clustering indexes, one

The account of the company (account number 0, initial balance 100) and the accounts of all employees (account numbers 1 to 100, initial balance 0) are with the same bank.. The

read locks released after read, write locks according to 2-phase locking reads can access only committed data. cursor stability: in addition, read is repeatable within single

(a) What join strategies does the system propose (i) without use of an index, (ii) with a unique non-clustering index on Publ.pubID, and (iii) with two clustering indexes, one

The account of the company (account number 0, initial balance 100) and the accounts of all employees (account numbers 1 to 100, initial balance 0) are with the same bank.. The