-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path07_write_skew_with_disjoint_sets_spec.log
More file actions
34 lines (34 loc) · 2.29 KB
/
07_write_skew_with_disjoint_sets_spec.log
File metadata and controls
34 lines (34 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[observer] CREATE TABLE events (
[observer] id text NOT NULL,
[observer] available_seats integer NOT NULL CHECK (available_seats >= 0),
[observer] PRIMARY KEY (id)
[observer] ); (5.2ms)
[observer] CREATE TABLE bookings (
[observer] id uuid DEFAULT gen_random_uuid() NOT NULL,
[observer] customer_name text NOT NULL,
[observer] seat_count integer NOT NULL,
[observer] event_id text NOT NULL,
[observer] FOREIGN KEY (event_id) REFERENCES events (id),
[observer] PRIMARY KEY (id)
[observer] ); (6.5ms)
[observer] BEGIN ISOLATION LEVEL READ COMMITTED (0.6ms)
[observer] INSERT INTO "events" ("id", "available_seats") VALUES ('event_a', 4) RETURNING "id" (0.8ms)
[observer] INSERT INTO "bookings" ("customer_name", "seat_count", "event_id") VALUES ('Alice', 1, 'event_a') RETURNING "id" (0.8ms)
[observer] INSERT INTO "bookings" ("customer_name", "seat_count", "event_id") VALUES ('Bob', 1, 'event_a') RETURNING "id" (0.5ms)
[observer] COMMIT (0.7ms)
[alice] BEGIN ISOLATION LEVEL REPEATABLE READ (0.7ms)
[alice] SELECT SUM("bookings"."seat_count") FROM "bookings" WHERE "bookings"."customer_name" IN ('Alice', 'Bob') AND "bookings"."event_id" = 'event_a' (0.8ms)
[alice] => 2
[bob] BEGIN ISOLATION LEVEL REPEATABLE READ (1.5ms)
[bob] SELECT SUM("bookings"."seat_count") FROM "bookings" WHERE "bookings"."customer_name" IN ('Alice', 'Bob') AND "bookings"."event_id" = 'event_a' (1.6ms)
[bob] => 2
[alice] UPDATE "bookings" SET "seat_count" = 2 WHERE "bookings"."customer_name" = 'Alice' AND "bookings"."event_id" = 'event_a' (2.6ms)
[alice] COMMIT (1.6ms)
[bob] UPDATE "bookings" SET "seat_count" = 2 WHERE "bookings"."customer_name" = 'Bob' AND "bookings"."event_id" = 'event_a' (1.7ms)
[bob] COMMIT (1.2ms)
[observer] SELECT SUM("bookings"."seat_count") FROM "bookings" WHERE "bookings"."customer_name" = 'Alice' AND "bookings"."event_id" = 'event_a' (3.6ms)
[observer] => 2
[observer] SELECT SUM("bookings"."seat_count") FROM "bookings" WHERE "bookings"."customer_name" = 'Bob' AND "bookings"."event_id" = 'event_a' (2.7ms)
[observer] => 2
[observer] DROP TABLE IF EXISTS bookings; (9.0ms)
[observer] DROP TABLE IF EXISTS events; (6.0ms)