SlideShare a Scribd company logo
For Any Assignment related queries, Call us at : - +1 678 648 4277
You can mail us at : - info@databasehomeworkhelp.com or
reach us at : - https://www.databasehomeworkhelp.com/
Problem 1.
To reduce the number of plans the query optimizer must consider, the Selinger
Optimizer employs a number of heuristics to reduce the search space. List three:
Solution.
a. Push selections down to the leaves.
b. Push projections down. – Consider only left deep plans.
c. Join tables without join predicates (cross product joins) as late as possible.
Problem 2.
Give one reason why the REDO pass of ARIES must use physical logging.
Solution.
The pages on disk may be in any state between “no updates applied” and “all updates
applied.” Logical redo cannot be used on an indeterminate state, whereas physically
redo
databasehomeworkhelp.com
logging just overwrites the data on disk with the logged values. In other words, physical
logging is idempotent whereas logical logging is not.
II Optimistic Concurrency Control
Problem 3.
For the following transaction schedules, indicate which transactions would commit and
which would abort when run using the parallel validation scheme described in the Kung
and Robinson paper on Optimistic ConcurrencyControl. Also give a brief justification for
your answer.You may assume that if a transaction aborts, it does not execute its write
phase, rolling back instantly at the end of the validation phase.
databasehomeworkhelp.com
Solution.
Transactions that commit:T1,T2 orT1
Transactions that abort: {} orT2
Justification:
There are two correct solutions:
T1 andT2 both commit.T1 commits because it validates first.T2 will also commit
because while its write set intersectsT1’s write set,T1 finishes its write phase beforeT2
starts its write phase (condition 2 in section 3.1 of the paper).
T1 commits,T2 aborts.T1 commits because it validates first. In the pseudocode from
the paper (section 5),T1 is executing the line marked “write phase” whenT2 starts its
validation phase.T2 findsT1 in the “finish active” set, and aborts due to a write/write
conflict.This is sort of a “false” conflict, since it would be safe forT2 to commit.
However, the parallel algorithm assumes thatT1 is still writing at the time thatT2
detects the conflict, so it must abort.
Problem 4.
databasehomeworkhelp.com
Solution
Transactions that commit:T1,T3
Transactions that abort:T2
Justification:
T1 andT3 commit,T2 aborts.T1 commits because it validates first.T2 must abort
becauseT1’s write set intersectsT2’s read set, andT2 was started reading beforeT1
finished writing.T3 then commit because although it has a conflict withT2, when it
begins the validation algorithm,T2 has already aborted (it finishes aborting at the end of
the validation phase).
databasehomeworkhelp.com
III Schema Design
Consider a relational table:
( professor
professor name, professor id,
student name, student office id,
student designated refrigerator id, refrigerator owner id,
refrigerator id, refrigerator size, secretary name,
secretary id, secretary office )
Suppose the data has the following properties:
A. Professors and secretaries have individual offices, students share offices.
B. Students can work for multiple professors.
C. Refrigerators are owned by one professor.
D. Professors can own multiple refrigerators.
E. Students can only use one refrigerator.
F. The refrigerator the student uses must be owned by one of the professors they work
for.
G. Secretaries can work for multiple professors.
H. Professors only have a single secretary.
databasehomeworkhelp.com
Problem 5.
[Put this table into 3rd normal form by writing out the decomposed tables; designate keys
in your tables by underlining them. Designate foreign keys by drawing an arrow from a
foreign key to the primary key it refers to. Note that some of the properties listed above
may not be enforced (i.e., guaranteed to be true) by a 3NF decomposition.
Solution.
databasehomeworkhelp.com
Problem 6.
Which of the eight properties (A–H) of the data are enforced (i.e., guaranteed to be true)
by the 3NF decomposition and primary and foreign keys you gave above
Solution:
B,C,D,E,G,H; the schema does not enfore that profs/secretaries have individual offices
or that students use the fridge of the professor they work for.
Problem 7.
What could a database administrator do to make sure the properties not explicitly
enforced by your schema are enforced by the database?
Solution.
Use triggers or stored procedures to ensure that these constraints are checked when
data is inserted or updated.
databasehomeworkhelp.com
IV External Aggregation
Suppose you are implementing an aggregation operator for a database system, and you
need to support aggregation over very large data sets with more groups than can fit into
memory.
Your friend Johnny Join begins writing out how he would implement the algorithm.
Unfortunately, he stayed up all night working on Lab 3 and so trails off in an incoherent
stream of obscenities and drool before finishing his code. His algorithm begins as follows:
input :TableT, aggregation function f name, aggregation field agg f , group by field gby
f /* AssumeT has |T| pages and your system has |M| pages of memory
/* Partition phase
n |T/M| ← ;
Allocate bu f s, n pages of memory for output buffers ;
Allocate f iles, an array of n files for partitions ;
foreach record r ∈T do
h ← hash(r.gby f) ; /* h ∈ [1 . . . n] */
Write r into page bu f s[h] ;
if page bu f s[h] is full then
Add bu f s[h] to file f iles[h], and set the contents of bu f s[h] to empty ;
end
databasehomeworkhelp.com
end
/* Aggregate phase
foreach f ∈ f iles do
/*Your code goes here.
End
Problem 8.
Relative to |T|, how big must |M| be for the algorithm to function correctly? Justify your
answer with a sentence or brief analytical argument.
Solution.
Because bu f s should fit in memory, n ≤ |M|.T
The number of hash buckets is computed as n = | M | . | |T
Plugging in for n, we get that | | M | | ≤ |M|.
Therefore, |T| ≤ |M| 2 .
It follows that |M| ≥ √ |T|.
Problem 9.
Assuming the aggregate phase does only one pass over the data, and that f name = ’AVG’,
databasehomeworkhelp.com
describe briefly what should go in the body of the for loop (in place of “Your code goes
here”).You may write pseudocode or a few short sentences. Suppose the system provides
a function emit(group,val) to output the value of a group.
Solution.
All tuples with the same gby f will end up in the same partition, but there may (very likely
will) be multiple gby f values per partition.
The basic algorithm should be something like:
H = new HashTable // stores (gbyf, ) pairs
for tuple t in f:
if (( = H.get(t.gbyf)) == null)
sum = sum + t.aggf cnt = cnt + 1
T.put(t.gbyf,)
for (group, ) inT:
emit(group,sum/cnt)
Any in-memory aggregation would work here, so if you prefer to sort the values in
memory and then bucket them as is done in the next question, that is also an acceptable
answer.
databasehomeworkhelp.com

More Related Content

PPTX
Electrical Engineering Exam Help
PDF
Introduction to database-Normalisation
PPTX
Database System.pptx
DOCX
Dbms final quiz1
PPT
PDF
Databasemanagementsystems Jntu Model Paper{Www.Studentyogi.Com}
PDF
D A T A B A S E M A N A G E M E N T S Y S T E M S J N T U M O D E L P A P ...
PPTX
Computer Science Assignment Help
Electrical Engineering Exam Help
Introduction to database-Normalisation
Database System.pptx
Dbms final quiz1
Databasemanagementsystems Jntu Model Paper{Www.Studentyogi.Com}
D A T A B A S E M A N A G E M E N T S Y S T E M S J N T U M O D E L P A P ...
Computer Science Assignment Help

Similar to databasehomeworkhelp.com_ Database System Assignment Help (1).pptx (20)

PPT
6 normalization
PDF
Data Warehouse ( Dw Of Dwh )
PDF
AC14 AT11 Database Management Systems OBJECTIVE TYPE QUESTIONS
PPTX
ExitExam Tutorial gfgfgfdfdfdfdf (1).pptx
PPTX
Algorithm Homework Help
PDF
Database Management System (1).pdf
PPTX
databasehomeworkhelp.com_Database Homework Help.pptx
PDF
Bt0066 database management system2
DOCX
DBMS Question bank
PPTX
Database Systems Assignment Help
PDF
[Www.pkbulk.blogspot.com]dbms09
DOCX
Mit202 data base management system(dbms)
PPTX
Computer Network Assignment Help
PPTX
Chapter-8 Relational Database Design
PDF
CSI2132: Database I – Assignment 3:
PDF
Relational Database Design
PDF
Hands-On Database 2nd Edition Steve Conger Solutions Manual
PPTX
DBSA QP project subbmisson project subbmisson .pptx
6 normalization
Data Warehouse ( Dw Of Dwh )
AC14 AT11 Database Management Systems OBJECTIVE TYPE QUESTIONS
ExitExam Tutorial gfgfgfdfdfdfdf (1).pptx
Algorithm Homework Help
Database Management System (1).pdf
databasehomeworkhelp.com_Database Homework Help.pptx
Bt0066 database management system2
DBMS Question bank
Database Systems Assignment Help
[Www.pkbulk.blogspot.com]dbms09
Mit202 data base management system(dbms)
Computer Network Assignment Help
Chapter-8 Relational Database Design
CSI2132: Database I – Assignment 3:
Relational Database Design
Hands-On Database 2nd Edition Steve Conger Solutions Manual
DBSA QP project subbmisson project subbmisson .pptx
Ad

More from Database Homework Help (17)

PPTX
SQL Query Fixes and Database Design Solutions
PPTX
Parcels' and 'Urisa' Databases in Oracle
PPTX
SQL queries and data analysis techniques
PPTX
SQL Query Solutions for database management problems
PPTX
Database Homework Help
PPTX
Database Homework Help
PPTX
Introduction To Database Security.pptx
PPTX
Introduction To Database Design.pptx
PPTX
Database and Systems Integration Technologies.pptx
PPTX
Database and Systems Integration Technologies (2).pptx
PPTX
Database and Systems Integration Technologies.pptx
PPTX
Database and Systems Integration Technologies.pptx
PPTX
Instant DBMS Assignment Help
PPTX
Database Homework Help
PPTX
Database Homework Help
PPTX
Instant DBMS Homework Help
PPTX
Database Management Assignment Help
SQL Query Fixes and Database Design Solutions
Parcels' and 'Urisa' Databases in Oracle
SQL queries and data analysis techniques
SQL Query Solutions for database management problems
Database Homework Help
Database Homework Help
Introduction To Database Security.pptx
Introduction To Database Design.pptx
Database and Systems Integration Technologies.pptx
Database and Systems Integration Technologies (2).pptx
Database and Systems Integration Technologies.pptx
Database and Systems Integration Technologies.pptx
Instant DBMS Assignment Help
Database Homework Help
Database Homework Help
Instant DBMS Homework Help
Database Management Assignment Help
Ad

Recently uploaded (20)

PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PDF
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
PDF
Insiders guide to clinical Medicine.pdf
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Cell Structure & Organelles in detailed.
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PDF
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
STATICS OF THE RIGID BODIES Hibbelers.pdf
How to Manage Starshipit in Odoo 18 - Odoo Slides
O7-L3 Supply Chain Operations - ICLT Program
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
NOI Hackathon - Summer Edition - GreenThumber.pptx
Revamp in MTO Odoo 18 Inventory - Odoo Slides
Cardiovascular Pharmacology for pharmacy students.pptx
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
Insiders guide to clinical Medicine.pdf
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Cell Structure & Organelles in detailed.
Open Quiz Monsoon Mind Game Final Set.pptx
Module 3: Health Systems Tutorial Slides S2 2025
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?

databasehomeworkhelp.com_ Database System Assignment Help (1).pptx

  • 1. For Any Assignment related queries, Call us at : - +1 678 648 4277 You can mail us at : - [email protected] or reach us at : - https://www.databasehomeworkhelp.com/
  • 2. Problem 1. To reduce the number of plans the query optimizer must consider, the Selinger Optimizer employs a number of heuristics to reduce the search space. List three: Solution. a. Push selections down to the leaves. b. Push projections down. – Consider only left deep plans. c. Join tables without join predicates (cross product joins) as late as possible. Problem 2. Give one reason why the REDO pass of ARIES must use physical logging. Solution. The pages on disk may be in any state between “no updates applied” and “all updates applied.” Logical redo cannot be used on an indeterminate state, whereas physically redo databasehomeworkhelp.com
  • 3. logging just overwrites the data on disk with the logged values. In other words, physical logging is idempotent whereas logical logging is not. II Optimistic Concurrency Control Problem 3. For the following transaction schedules, indicate which transactions would commit and which would abort when run using the parallel validation scheme described in the Kung and Robinson paper on Optimistic ConcurrencyControl. Also give a brief justification for your answer.You may assume that if a transaction aborts, it does not execute its write phase, rolling back instantly at the end of the validation phase. databasehomeworkhelp.com
  • 4. Solution. Transactions that commit:T1,T2 orT1 Transactions that abort: {} orT2 Justification: There are two correct solutions: T1 andT2 both commit.T1 commits because it validates first.T2 will also commit because while its write set intersectsT1’s write set,T1 finishes its write phase beforeT2 starts its write phase (condition 2 in section 3.1 of the paper). T1 commits,T2 aborts.T1 commits because it validates first. In the pseudocode from the paper (section 5),T1 is executing the line marked “write phase” whenT2 starts its validation phase.T2 findsT1 in the “finish active” set, and aborts due to a write/write conflict.This is sort of a “false” conflict, since it would be safe forT2 to commit. However, the parallel algorithm assumes thatT1 is still writing at the time thatT2 detects the conflict, so it must abort. Problem 4. databasehomeworkhelp.com
  • 5. Solution Transactions that commit:T1,T3 Transactions that abort:T2 Justification: T1 andT3 commit,T2 aborts.T1 commits because it validates first.T2 must abort becauseT1’s write set intersectsT2’s read set, andT2 was started reading beforeT1 finished writing.T3 then commit because although it has a conflict withT2, when it begins the validation algorithm,T2 has already aborted (it finishes aborting at the end of the validation phase). databasehomeworkhelp.com
  • 6. III Schema Design Consider a relational table: ( professor professor name, professor id, student name, student office id, student designated refrigerator id, refrigerator owner id, refrigerator id, refrigerator size, secretary name, secretary id, secretary office ) Suppose the data has the following properties: A. Professors and secretaries have individual offices, students share offices. B. Students can work for multiple professors. C. Refrigerators are owned by one professor. D. Professors can own multiple refrigerators. E. Students can only use one refrigerator. F. The refrigerator the student uses must be owned by one of the professors they work for. G. Secretaries can work for multiple professors. H. Professors only have a single secretary. databasehomeworkhelp.com
  • 7. Problem 5. [Put this table into 3rd normal form by writing out the decomposed tables; designate keys in your tables by underlining them. Designate foreign keys by drawing an arrow from a foreign key to the primary key it refers to. Note that some of the properties listed above may not be enforced (i.e., guaranteed to be true) by a 3NF decomposition. Solution. databasehomeworkhelp.com
  • 8. Problem 6. Which of the eight properties (A–H) of the data are enforced (i.e., guaranteed to be true) by the 3NF decomposition and primary and foreign keys you gave above Solution: B,C,D,E,G,H; the schema does not enfore that profs/secretaries have individual offices or that students use the fridge of the professor they work for. Problem 7. What could a database administrator do to make sure the properties not explicitly enforced by your schema are enforced by the database? Solution. Use triggers or stored procedures to ensure that these constraints are checked when data is inserted or updated. databasehomeworkhelp.com
  • 9. IV External Aggregation Suppose you are implementing an aggregation operator for a database system, and you need to support aggregation over very large data sets with more groups than can fit into memory. Your friend Johnny Join begins writing out how he would implement the algorithm. Unfortunately, he stayed up all night working on Lab 3 and so trails off in an incoherent stream of obscenities and drool before finishing his code. His algorithm begins as follows: input :TableT, aggregation function f name, aggregation field agg f , group by field gby f /* AssumeT has |T| pages and your system has |M| pages of memory /* Partition phase n |T/M| ← ; Allocate bu f s, n pages of memory for output buffers ; Allocate f iles, an array of n files for partitions ; foreach record r ∈T do h ← hash(r.gby f) ; /* h ∈ [1 . . . n] */ Write r into page bu f s[h] ; if page bu f s[h] is full then Add bu f s[h] to file f iles[h], and set the contents of bu f s[h] to empty ; end databasehomeworkhelp.com
  • 10. end /* Aggregate phase foreach f ∈ f iles do /*Your code goes here. End Problem 8. Relative to |T|, how big must |M| be for the algorithm to function correctly? Justify your answer with a sentence or brief analytical argument. Solution. Because bu f s should fit in memory, n ≤ |M|.T The number of hash buckets is computed as n = | M | . | |T Plugging in for n, we get that | | M | | ≤ |M|. Therefore, |T| ≤ |M| 2 . It follows that |M| ≥ √ |T|. Problem 9. Assuming the aggregate phase does only one pass over the data, and that f name = ’AVG’, databasehomeworkhelp.com
  • 11. describe briefly what should go in the body of the for loop (in place of “Your code goes here”).You may write pseudocode or a few short sentences. Suppose the system provides a function emit(group,val) to output the value of a group. Solution. All tuples with the same gby f will end up in the same partition, but there may (very likely will) be multiple gby f values per partition. The basic algorithm should be something like: H = new HashTable // stores (gbyf, ) pairs for tuple t in f: if (( = H.get(t.gbyf)) == null) sum = sum + t.aggf cnt = cnt + 1 T.put(t.gbyf,) for (group, ) inT: emit(group,sum/cnt) Any in-memory aggregation would work here, so if you prefer to sort the values in memory and then bucket them as is done in the next question, that is also an acceptable answer. databasehomeworkhelp.com