Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

PostgreSQL PGCES-02 Exam - Topic 2 Question 3 Discussion

Posted by Janine on May 09, 2022 at 02:01 AM

Table "t1" is defined below. Table "t1" has a column "id" of type INTEGER, and a column "name" of type TEXT. t1: The following SQL is executed while client "A" is connected. BEGIN;

SELECT * FROM t1 WHERE id = 2 FOR UPDATE; SELECT * FROM t1 WHERE id = 1 FOR UPDATE; -- (*) While the second 'SELECT' statement, shown with (*), is being executed, a separate client "B" connects and executes the following SQL. Select the correct statement about the execution results. UPDATE t1 SET name = 'turtle' WHERE id = 2; Note: the default transaction isolation level is set to "read committed".

Suggested Answer: B

Get Premium PGCES-02 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
12 comments · newest first
CA
Caitlin 11 months ago
E sounds like a stretch, deadlock isn't happening here.
IS
Isabella 11 months ago
I think C is wrong, B can't just proceed like that.
SH
Sharan 12 months ago
Wait, does that mean B can't update anything at all?
IS
Isadora 12 months ago
Totally agree, B will be blocked until A finishes.
ME
Meghann 12 months ago
Client A's transaction locks the row for id 2.
ED
Edna 1 year ago
I recall something about deadlocks, but I don't think that's happening here since client 'B' is just waiting on client 'A'.
GA
Gabriele 1 year ago
I'm not entirely sure, but I feel like client 'B' should be able to proceed since it's not trying to update the same row as client 'A'.
TH
Therese 1 year ago
I think the update from client 'B' might be blocked because client 'A' has a lock on the row with id = 2.
PR
Princess 1 year ago
I remember practicing a similar question where one transaction had to wait for another to finish. I think that applies here too.
LE
Levi 1 year ago
I'm pretty sure web spiders are used for indexing websites, so I'll go with option A.
YU
Yuette 1 year ago
This is a good test of my understanding of the cost of quality. I'll carefully consider each option and try to apply the definition I know to determine the best answer.
SY
Sylvia 1 year ago
I'm a bit unsure about this one. I want to make sure I'm not missing any details in the question.
0/2000 characters

Save Cancel