# LogicTest: local-read-committed

statement ok
CREATE TABLE kv (k INT PRIMARY KEY, v INT, FAMILY (k, v))

statement ok
INSERT INTO kv VALUES (1,10), (2,20), (3,30), (4,40);

# Test that non-default isolation level, priority, and QoS are correct.

statement ok
SET default_transaction_isolation = 'read committed'

statement ok
SET default_transaction_quality_of_service = background

statement ok
BEGIN ISOLATION LEVEL READ COMMITTED PRIORITY LOW

query T
EXPLAIN ANALYZE (PLAN) SELECT * FROM kv WHERE k >= 2
----
planning time: 10µs
execution time: 100µs
distribution: <hidden>
vectorized: <hidden>
plan type: custom
rows decoded from KV: 3 (24 B, 6 KVs, 3 gRPC calls)
maximum memory usage: <hidden>
network usage: <hidden>
regions: <hidden>
isolation level: read committed
priority: low
quality of service: background
·
• scan
  sql nodes: <hidden>
  kv nodes: <hidden>
  regions: <hidden>
  actual row count: 3
  KV time: 0µs
  KV contention time: 0µs
  KV rows decoded: 3
  KV pairs read: 6
  KV bytes read: 24 B
  KV gRPC calls: 3
  estimated max memory allocated: 0 B
  missing stats
  table: kv@kv_pkey
  spans: [/2 - ]

statement ok
ROLLBACK

statement ok
RESET default_transaction_quality_of_service

statement ok
CREATE TABLE ab (a INT PRIMARY KEY, b INT);
INSERT INTO ab VALUES (10,100), (40,400), (50,500);

query T
EXPLAIN ANALYZE (PLAN, VERBOSE) SELECT * FROM kv JOIN ab ON v=a
----
planning time: 10µs
execution time: 100µs
distribution: <hidden>
vectorized: <hidden>
plan type: custom
rows decoded from KV: 7 (56 B, 14 KVs, 7 gRPC calls)
maximum memory usage: <hidden>
network usage: <hidden>
regions: <hidden>
isolation level: read committed
priority: normal
quality of service: regular
·
• hash join (inner)
│ columns: (k, v, a, b)
│ sql nodes: <hidden>
│ regions: <hidden>
│ actual row count: 2
│ vectorized batch count: 0
│ estimated max memory allocated: 0 B
│ estimated max sql temp disk usage: 0 B
│ estimated row count: 990 (missing stats)
│ equality: (v) = (a)
│ right cols are key
│
├── • scan
│     columns: (k, v)
│     sql nodes: <hidden>
│     kv nodes: <hidden>
│     regions: <hidden>
│     actual row count: 4
│     vectorized batch count: 0
│     KV time: 0µs
│     KV contention time: 0µs
│     KV rows decoded: 4
│     KV pairs read: 8
│     KV bytes read: 32 B
│     KV gRPC calls: 4
│     estimated max memory allocated: 0 B
│     MVCC step count (ext/int): 0/0
│     MVCC seek count (ext/int): 0/0
│     estimated row count: 1,000 (missing stats)
│     table: kv@kv_pkey
│     spans: FULL SCAN
│
└── • scan
      columns: (a, b)
      sql nodes: <hidden>
      kv nodes: <hidden>
      regions: <hidden>
      actual row count: 3
      vectorized batch count: 0
      KV time: 0µs
      KV contention time: 0µs
      KV rows decoded: 3
      KV pairs read: 6
      KV bytes read: 24 B
      KV gRPC calls: 3
      estimated max memory allocated: 0 B
      MVCC step count (ext/int): 0/0
      MVCC seek count (ext/int): 0/0
      estimated row count: 1,000 (missing stats)
      table: ab@ab_pkey
      spans: FULL SCAN
