I

  1. Let R and S be 2 relations. R has 10.000 records; a page can hold 10 R records.

    S has 2.000 records; a page can hold 10 S records.

    52 buffer pages are available.

    Compute the cost of:

    SELECT *

    FROM R INNER JOIN S

    ON R.a = S.b

    using page-oriented nested loops join and block nested loops join;

    S is the outer relation.

⇒ we need to consider the number of I/O operations required for each join algorithm:

Therefore, the cost of the SELECT query using page-oriented nested loops join is 200200 I/Os, and the cost using block nested loops join is 4200 I/Os.

  1. Let R and S be 2 relations.

    R has 10.000 records; a page can hold 10 R records.

    S has 2.000 records; a page can hold 10 S records.

    Compute the cost of sorting R using external merge sort with 200 buffer pages.

    Screenshot 2023-06-05 at 00.29.22.png

  2. Let R and S be 2 relations.

    R has 10.000 records; a page can hold 10 R records.

    S has 2.000 records; a page can hold 10 S records.

    R is stored at București, S is stored at Cluj-Napoca.

    Compute the cost of: SELECT *

    FROM R INNER JOIN S

    ON R.a = S.b

    using simple nested loops join (tuple-oriented) in Cluj-Napoca, without caching;

    S is the outer relation.

  3. Encode the data de gustibus non disputandum using the secret encryption key metallica and the table of codes below. Write the last 5 characters in the result.

    Screenshot 2023-06-05 at 00.30.53.png

II

  1. T1 and T2 are 2 concurrent transactions, both active at time t.

    Choose the correct answer(s): a. The following execution describes a write read conflict: At time t, T2 is reading a data object previously written by T1. b. The following execution describes a write read conflict: At time t, T2 is writing a data object previously read by T1. c. The following execution describes a read write conflict: At time t, T2 is reading a data object previously written by T1. d. The following execution describes a read write conflict: At time t, T2 is writing a data object previously read by T1. e. none of the above answers is correct.

    In a write read conflict, one transaction writes a data object and another transaction reads the same data object. This creates a conflict because the reading transaction might see an inconsistent state if it reads the data object before the writing transaction commits its changes.

  2. A schedule S:

    a. is conflict serializable if and only if its precedence graph has exactly one cycle.

    b. is conflict serializable if and only if its precedence graph is acyclic.

    c. is conflict serializable if and only if its precedence graph has exactly two cycles.

    d. is conflict serializable if and only if its precedence graph has exactly three cycles.

    e. none of the above answers is correct.

    Conflict serializability is a property of a schedule in concurrency control, indicating that the schedule is equivalent to some serial schedule. A schedule is conflict serializable if the order of conflicting operations (read-write or write-write) in the schedule can be rearranged to form a valid serial schedule without changing the outcome of the transactions.

    The precedence graph represents the conflicts between operations in a schedule. It is a directed graph where the nodes represent the transactions, and the edges represent the conflicts between transactions. In the precedence graph, a cycle indicates a conflict that cannot be resolved, and therefore the schedule is not conflict serializable.

    Options a, c, and d are incorrect because they specify a specific number of cycles in the precedence graph as a condition for conflict serializability, which is not accurate. The presence of any cycle in the precedence graph indicates a conflict that violates conflict serializability.

  3. In SQL Server, under the READ UNCOMMITTED isolation level:

  4. In horizontal fragmentation:

  5. I is an index with search key <C1, C2, C3, C4>.

  6. Let R be a relation with P pages. The cost of sorting R using simple two-way merge sort (i.e., with 3 pages in the buffer pool) is:

  7. Consider the query: SELECT * FROM R1, R2, R3 WHERE p1 AND p2 AND p3 The conditions tested by the predicates in the WHERE clause are statistically independent. The cardinality of a relation R is denoted by |R|. The reduction factor associated with predicate p is denoted by RF(p). The cardinality of the query’s result set can be estimated by: