lab2
Application / Линт, типы и собственные тесты (pull_request) Canceled after 0s
Application / Стенд Compose, smoke, рестарт и отказы зависимостей (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
Artyom
2026-10-30 12:32:42 +03:00
parent 65003b6119
commit 6d8b76b447
222 changed files with 19685 additions and 18 deletions
+27
View File
@@ -0,0 +1,27 @@
date: 2026-10-28T17:16:16Z commit: 6468ee2
$ valkey-cli config get appendonly appendfsync maxmemory maxmemory-policy
appendonly
yes
appendfsync
always
maxmemory
67108864
maxmemory-policy
volatile-lru
$ valkey-cli info persistence | grep aof_enabled,aof_last_write_status
aof_enabled:1
aof_last_write_status:ok
$ valkey-cli dbsize; info stats | grep keyspace
4
keyspace_hits:2
keyspace_misses:2
$ valkey-cli --scan --pattern 'session:*' и вид значения (хеш сокращён, значения не печатаются)
session:253ef5d9… сессия
session:59c9c3c4… сессия
session:b86641dc… сессия
session:95ea586e… отметка отзыва "-"
tombstones: 1, cached sessions: 3
$ срок ключа кэша против срока сессии для session:253ef5d9…
valkey pexpiretime, ms: 1793208059163
postgres expires_at, ms: 1793211358951
ключ не переживает сессию: да
+17
View File
@@ -0,0 +1,17 @@
date: 2026-10-28T17:14:50Z commit: 6468ee2
$ make check
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
$ make validate
.venv/bin/python scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
$ make lint
.venv/bin/ruff check src student-tests scripts/track.py
All checks passed!
.venv/bin/ruff format --check src student-tests scripts/track.py
96 files already formatted
.venv/bin/ty check src student-tests
All checks passed!
$ make test
python3 tests/smoke.py --base-url "http://localhost:18082"
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
+41
View File
@@ -0,0 +1,41 @@
date: 2026-10-28T17:31:07Z commit: 6468ee2
host: Apple M4 Max, 16 CPU, 48 GiB RAM, macOS 15.1
docker: 28.3.2, VM: 16 CPU, 8217190400 bytes
compose: 2.38.2-desktop.1
images:
mtusi-messenger:mtusi2026lab2
postgres:17.11-alpine@sha256:266d3c257594e195b309ae9d1805e54c788f1d7b375f56bf6c367aac6c917e7b
valkey/valkey:8.1.11-alpine@sha256:2602ace2be6569bc2bbb06f873776516ab9089821525be34f4305c67eb9db02a
FROM python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d AS builder
COPY --from=ghcr.io/astral-sh/uv:0.9.7@sha256:ba4857bf2a068e9bc0e64eed8563b065908a4cd6bfb66b531a9c424c8e25e142 /uv /usr/local/bin/uv
FROM python:3.14-slim-trixie@sha256:51dafde81dbdb6ebde285137a295cf18a47ca95234fe388a343719cb97305b3d AS runtime
COPY --from=builder --chown=root:root /opt/venv /opt/venv
python in image: Python 3.14.7
packages (uv.lock):
fastapi 0.141.1
uvicorn 0.54.0
uvicorn-worker 0.4.0
gunicorn 26.2.0
asyncpg 0.32.0
argon2-cffi 25.1.0
pydantic 2.13.5
pydantic-settings 2.15.0
dishka 1.10.1
structlog 26.1.0
redis 8.1.0
$ docker compose --profile faults --profile track up -d --wait api-shortttl postgres-restore
docker compose top (service, UID, command), без повторов и без процессов healthcheck:
api 10001 python
api-shortttl 10001 python
postgres 70 postgres
postgres 70 postgres:
postgres-restore 70 postgres
postgres-restore 70 postgres:
valkey 999 tini
valkey 999 valkey-server
postgres durability (pg_settings):
fsync = on
full_page_writes = on
shared_buffers = 16384
synchronous_commit = on
wal_sync_method = fdatasync
+80
View File
@@ -0,0 +1,80 @@
date: 2026-10-28T17:16:18Z commit: 6468ee2
$ make explain # scripts/sql/explain-history.sql
chat_messages
---------------
20000
(1 row)
all_messages
--------------
30005
(1 row)
history_index_size
--------------------
1736 kB
(1 row)
== Первая страница, limit=50 (запрос HISTORY_FIRST приложения, LIMIT limit+1)
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.29..5.37 rows=51 width=102) (actual time=0.008..0.013 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_history_idx on messages (cost=0.29..1994.42 rows=20001 width=102) (actual time=0.007..0.010 rows=51 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-00000000c001'::uuid)
Buffers: shared hit=3
Planning:
Buffers: shared hit=24
Planning Time: 0.081 ms
Execution Time: 0.022 ms
(9 rows)
== Глубокая страница: keyset после 10 000-го сообщения (запрос HISTORY_AFTER приложения)
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.29..9.99 rows=51 width=102) (actual time=0.007..0.012 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_history_idx on messages (cost=0.29..1269.18 rows=6670 width=102) (actual time=0.007..0.010 rows=51 loops=1)
Index Cond: ((chat_id = '00000000-0000-7000-8000-00000000c001'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 02:46:40+00'::timestamp with time zone, '00000000-0000-7000-8001-000000002710'::uuid)))
Buffers: shared hit=4
Planning Time: 0.034 ms
Execution Time: 0.032 ms
(7 rows)
== Та же глубокая страница через OFFSET 10000 (не используется приложением, для сравнения)
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=997.30..1002.39 rows=51 width=102) (actual time=0.879..0.885 rows=51 loops=1)
Buffers: shared hit=247
-> Index Scan using messages_history_idx on messages (cost=0.29..1994.42 rows=20001 width=102) (actual time=0.010..0.674 rows=10051 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-00000000c001'::uuid)
Buffers: shared hit=247
Planning Time: 0.046 ms
Execution Time: 0.897 ms
(7 rows)
== Проверка: keyset и OFFSET возвращают одну и ту же страницу
same_page
-----------
t
(1 row)
== Контрольный план без индекса истории (DROP INDEX внутри транзакции, затем ROLLBACK)
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=1246.61..1246.74 rows=51 width=102) (actual time=1.473..1.478 rows=51 loops=1)
Buffers: shared hit=505
-> Sort (cost=1246.61..1263.29 rows=6670 width=102) (actual time=1.473..1.473 rows=51 loops=1)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 31kB
Buffers: shared hit=505
-> Seq Scan on messages (cost=0.00..1024.09 rows=6670 width=102) (actual time=0.291..1.073 rows=10000 loops=1)
Filter: ((chat_id = '00000000-0000-7000-8000-00000000c001'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 02:46:40+00'::timestamp with time zone, '00000000-0000-7000-8001-000000002710'::uuid)))
Rows Removed by Filter: 20005
Buffers: shared hit=499
Planning:
Buffers: shared hit=14
Planning Time: 0.084 ms
Execution Time: 1.486 ms
(14 rows)
+73
View File
@@ -0,0 +1,73 @@
date: 2026-10-28T17:15:43Z commit: 6468ee2
$ make test-faults
docker compose --profile faults up -d --wait api-shortttl
Container mtusi2026lab2-valkey-1 Running
Container mtusi2026lab2-postgres-1 Running
Container mtusi2026lab2-api-shortttl-1 Creating
Container mtusi2026lab2-api-shortttl-1 Created
Container mtusi2026lab2-postgres-1 Waiting
Container mtusi2026lab2-postgres-1 Healthy
Container mtusi2026lab2-migrate-1 Starting
Container mtusi2026lab2-migrate-1 Started
Container mtusi2026lab2-migrate-1 Waiting
Container mtusi2026lab2-migrate-1 Exited
Container mtusi2026lab2-api-shortttl-1 Starting
Container mtusi2026lab2-api-shortttl-1 Started
Container mtusi2026lab2-migrate-1 Waiting
Container mtusi2026lab2-api-shortttl-1 Waiting
Container mtusi2026lab2-postgres-1 Waiting
Container mtusi2026lab2-valkey-1 Waiting
Container mtusi2026lab2-valkey-1 Healthy
Container mtusi2026lab2-postgres-1 Healthy
Container mtusi2026lab2-migrate-1 Exited
Container mtusi2026lab2-api-shortttl-1 Healthy
BASE_URL="http://localhost:18082" SHORTTTL_URL="http://localhost:22082" .venv/bin/pytest -m stack -v -s student-tests/stack
============================= test session starts ==============================
platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0 -- /Users/artemkostylev/projects/learning/HL/labs/mtusi2026lab2/.venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/artemkostylev/projects/learning/HL/labs/mtusi2026lab2
configfile: pyproject.toml
plugins: asyncio-1.4.0, anyio-4.15.1
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collecting ... collected 13 items
student-tests/stack/test_faults.py::test_registration_race_yields_exactly_one_user гонка 50 регистраций: 201×1, 409×49
PASSED
student-tests/stack/test_faults.py::test_chat_creation_rolls_back_on_unknown_member чат с несуществующим участником: 400 invalid_request
PASSED
student-tests/stack/test_faults.py::test_wrong_password_and_unknown_user_get_same_basic_challenge неверный пароль: 401 за 0.012 с
неизвестный пользователь: 401 за 0.011 с
PASSED
student-tests/stack/test_faults.py::test_logout_then_token_is_dead logout: 204, затем 401, повтор 401
PASSED
student-tests/stack/test_faults.py::test_short_ttl_session_expires SESSION_TTL_SECONDS=2: сразу 200, через 3 с 401
PASSED
student-tests/stack/test_faults.py::test_valkey_serves_repeated_checks 5 проверок токена: keyspace_hits 4 → 9
PASSED
student-tests/stack/test_faults.py::test_valkey_stopped_is_bypassed_but_logout_waits valkey остановлен, действующий токен: 200 за 0.207 с
valkey остановлен, неизвестный токен: 401 за 0.004 с
valkey остановлен: ready 200, вход 201, выход 503
valkey снова запущен: повторный выход 204
PASSED
student-tests/stack/test_faults.py::test_valkey_restart_keeps_cache_and_revocations рестарт valkey: ключей 14 → 14
рестарт valkey: живой 200, отозванный 401
PASSED
student-tests/stack/test_faults.py::test_valkey_flushall_loses_nothing FLUSHALL: живой 200, отозванный 401
PASSED
student-tests/stack/test_faults.py::test_postgres_stopped_gives_bounded_503_and_recovers postgres остановлен, ready: 503 за 1.012 с
postgres остановлен, live: 200 за 0.006 с
postgres остановлен, me: 503 за 1.006 с
postgres остановлен, stranger: 503 за 1.012 с
postgres остановлен, login: 503 за 1.005 с
postgres остановлен, register: 503 за 0.992 с
postgres запущен: готовность через 0.0 с, прежний токен 200
PASSED
student-tests/stack/test_faults.py::test_api_restart_keeps_session_without_extending_it рестарт api: готовность через 0.5 с, токен 200
expires_at при входе 2026-10-28T18:16:04.950293Z, в БД после рестарта 2026-10-28T18:16:04.950293Z
PASSED
student-tests/stack/test_faults.py::test_full_restart_keeps_session_until_logout restart.sh: готовность через 0.0 с, прежний токен 200, выход 204, затем 401
PASSED
student-tests/stack/test_faults.py::test_short_ttl_expires_after_restart_at_original_time рестарт api-shortttl: готовность через 0.5 с, после expires_at входа 401
PASSED
============================= 13 passed in 26.08s ==============================
+14
View File
@@ -0,0 +1,14 @@
date: 2026-10-28T17:31:06Z commit: 6468ee2
$ psql -c "SELECT substring(password_hash from '^[$]argon2id[$]v=[0-9]+[$]m=[0-9]+,t=[0-9]+,p=[0-9]+[$]') AS kdf_prefix, username = 'seed_author' AS seed_stub, count(*) AS users, min(length(password_hash)) AS min_length, max(length(password_hash)) AS max_length FROM users GROUP BY 1, 2 ORDER BY 2"
kdf_prefix | seed_stub | users | min_length | max_length
---------------------------------+-----------+-------+------------+------------
$argon2id$v=19$m=19456,t=2,p=1$ | f | 34 | 97 | 97
$argon2id$v=19$m=19456,t=2,p=1$ | t | 1 | 44 | 44
(2 rows)
$ psql -c "SELECT octet_length(token_hash) AS stored_bytes, count(*) AS sessions FROM sessions GROUP BY 1"
stored_bytes | sessions
--------------+----------
32 | 27
(1 row)
+17
View File
@@ -0,0 +1,17 @@
{
"lab": 2,
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 8.0,
"elapsed_seconds": 8.115,
"concurrency": 64,
"successful_requests": 13600,
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 1675.852,
"successful_latency_ms": {
"p50": 30.112,
"p95": 86.847,
"p99": 112.662
},
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
}
+17
View File
@@ -0,0 +1,17 @@
{
"lab": 2,
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 8.0,
"elapsed_seconds": 8.129,
"concurrency": 64,
"successful_requests": 13163,
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 1619.165,
"successful_latency_ms": {
"p50": 30.37,
"p95": 87.703,
"p99": 111.511
},
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
}
+17
View File
@@ -0,0 +1,17 @@
{
"lab": 2,
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 8.0,
"elapsed_seconds": 8.141,
"concurrency": 64,
"successful_requests": 13933,
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 1711.47,
"successful_latency_ms": {
"p50": 27.216,
"p95": 83.269,
"p99": 103.729
},
"note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead."
}
+67
View File
@@ -0,0 +1,67 @@
date: 2026-10-28T17:16:35Z commit: 6468ee2
условия: closed-loop tests/load.py, 64 потока, 8 с без прогрева, 3 повтора с паузой 40 с (TIME_WAIT клиента), один чат на прогон, api 4 воркера × пул 8, клиент на хосте macOS
другие стенды Docker в это время:
== прогон 1
$ python3 tests/load.py --duration 8 --concurrency 64 --output evidence/load-c64-1.json
$ docker stats --no-stream на 4-й секунде
mtusi2026lab2-api-1 164.88% 254.4MiB / 7.653GiB
mtusi2026lab2-api-shortttl-1 0.06% 76.9MiB / 7.653GiB
mtusi2026lab2-postgres-1 156.93% 135.4MiB / 7.653GiB
mtusi2026lab2-valkey-1 5.36% 14.27MiB / 7.653GiB
$ pg_stat_activity: состояние и ожидание соединений messenger, кроме простаивающих, 20 снимков через 0.1 с
192 active Lock:tuple
91 active Lock:transactionid
32 active LWLock:LockManager
14 idle in transaction Client:ClientRead
10 active CPU
4 active IO:WalSync
2 idle in transaction CPU
2 active Client:ClientRead
успешных 13600 ошибок 0 RPS 1675.852 p50/p95/p99 30.112/86.847/112.662 мс
$ docker compose logs api --since 15s | статусы request.handled
7 "status":200
13607 "status":201
== прогон 2
$ python3 tests/load.py --duration 8 --concurrency 64 --output evidence/load-c64-2.json
$ docker stats --no-stream на 4-й секунде
mtusi2026lab2-api-1 162.27% 262.2MiB / 7.653GiB
mtusi2026lab2-api-shortttl-1 14.80% 76.9MiB / 7.653GiB
mtusi2026lab2-postgres-1 137.73% 140.9MiB / 7.653GiB
mtusi2026lab2-valkey-1 4.88% 14.14MiB / 7.653GiB
$ pg_stat_activity: состояние и ожидание соединений messenger, кроме простаивающих, 20 снимков через 0.1 с
176 active Lock:tuple
58 active Lock:transactionid
27 active LWLock:LockManager
14 active CPU
8 idle in transaction Client:ClientRead
4 active Client:ClientRead
1 idle in transaction CPU
1 active LWLock:BufferContent
1 active IO:WalSync
успешных 13163 ошибок 0 RPS 1619.165 p50/p95/p99 30.37/87.703/111.511 мс
$ docker compose logs api --since 15s | статусы request.handled
7 "status":200
13170 "status":201
== прогон 3
$ python3 tests/load.py --duration 8 --concurrency 64 --output evidence/load-c64-3.json
$ docker stats --no-stream на 4-й секунде
mtusi2026lab2-api-1 163.71% 280.2MiB / 7.653GiB
mtusi2026lab2-api-shortttl-1 0.07% 76.9MiB / 7.653GiB
mtusi2026lab2-postgres-1 148.17% 144.1MiB / 7.653GiB
mtusi2026lab2-valkey-1 5.67% 14.12MiB / 7.653GiB
$ pg_stat_activity: состояние и ожидание соединений messenger, кроме простаивающих, 20 снимков через 0.1 с
193 active Lock:tuple
69 active Lock:transactionid
14 active LWLock:LockManager
13 active CPU
5 idle in transaction CPU
4 idle in transaction Client:ClientRead
4 active IO:WalSync
2 idle in transaction IO:WalSync
1 active Client:ClientRead
успешных 13933 ошибок 0 RPS 1711.47 p50/p95/p99 27.216/83.269/103.729 мс
$ docker compose logs api --since 15s | статусы request.handled
7 "status":200
13940 "status":201
== медиана трёх прогонов
RPS 1675.852 [1619.165..1711.47], p50 30.112 мс, p95 86.847 мс, p99 111.511 мс, ошибок 0
+36
View File
@@ -0,0 +1,36 @@
date: 2026-10-28T17:14:42Z commit: 6468ee2
== применение к пустому volume
$ make reset-data && make up
$ docker compose logs --no-log-prefix migrate
{"version":"0001_init","event":"migration.applied","level":"info","ts":"2026-10-28T17:14:47.224527Z"}
{"reason":"applied","event":"migration.completed","level":"info","ts":"2026-10-28T17:14:47.224610Z"}
$ psql -c "SELECT (SELECT count(*) FROM users) users, (SELECT count(*) FROM sessions) sessions, (SELECT count(*) FROM chats) chats, (SELECT count(*) FROM chat_members) members, (SELECT count(*) FROM messages) messages, (SELECT count(*) FROM schema_migrations) versions"
users | sessions | chats | members | messages | versions
-------+----------+-------+---------+----------+----------
0 | 0 | 0 | 0 | 0 | 1
(1 row)
$ psql -c "SELECT version, left(checksum, 12) AS checksum, applied_at FROM schema_migrations"
version | checksum | applied_at
-----------+--------------+------------------------------
0001_init | 9a13618f078a | 2026-10-28 17:14:47.21836+00
(1 row)
== повторный запуск на заполненной БД
$ make test
python3 tests/smoke.py --base-url "http://localhost:18082"
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
$ psql -c "SELECT (SELECT count(*) FROM users) users, (SELECT count(*) FROM sessions) sessions, (SELECT count(*) FROM chats) chats, (SELECT count(*) FROM chat_members) members, (SELECT count(*) FROM messages) messages, (SELECT count(*) FROM schema_migrations) versions"
users | sessions | chats | members | messages | versions
-------+----------+-------+---------+----------+----------
3 | 2 | 1 | 2 | 2 | 1
(1 row)
$ make migrate
{"reason":"up to date","event":"migration.completed","level":"info","ts":"2026-10-28T17:14:50.421856Z"}
$ psql -c "SELECT (SELECT count(*) FROM users) users, (SELECT count(*) FROM sessions) sessions, (SELECT count(*) FROM chats) chats, (SELECT count(*) FROM chat_members) members, (SELECT count(*) FROM messages) messages, (SELECT count(*) FROM schema_migrations) versions"
users | sessions | chats | members | messages | versions
-------+----------+-------+---------+----------+----------
3 | 2 | 1 | 2 | 2 | 1
(1 row)
+14
View File
@@ -0,0 +1,14 @@
date: 2026-10-28T17:15:38Z commit: 6468ee2
== before: service StartedAt status
postgres 2026-10-28T17:14:45.771182542Z running
migrate 2026-10-28T17:14:46.867549042Z exited
valkey 2026-10-28T17:14:45.770904042Z running
api 2026-10-28T17:14:47.462394959Z running
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:18082"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
== after: service StartedAt status
postgres 2026-10-28T17:15:40.432032345Z running
migrate 2026-10-28T17:15:41.475733721Z exited
valkey 2026-10-28T17:15:40.539058345Z running
api 2026-10-28T17:15:42.059123013Z running
+111
View File
@@ -0,0 +1,111 @@
date: 2026-10-28T17:31:05Z commit: 6468ee2
$ psql -c '\d+ users'
Table "public.users"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
---------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
id | uuid | | not null | | plain | | |
username | text | | not null | | extended | | |
display_name | text | | not null | | extended | | |
password_hash | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"users_pkey" PRIMARY KEY, btree (id)
"users_username_key" UNIQUE CONSTRAINT, btree (username)
Check constraints:
"users_display_name_check" CHECK (char_length(display_name) >= 1 AND char_length(display_name) <= 100)
"users_password_hash_check" CHECK (password_hash ~~ '$argon2id$%'::text)
"users_username_format" CHECK (username ~ '^[a-z0-9_]{3,32}$'::text)
Referenced by:
TABLE "chat_members" CONSTRAINT "chat_members_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id)
TABLE "sessions" CONSTRAINT "sessions_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
Access method: heap
$ psql -c '\d+ sessions'
Table "public.sessions"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
token_hash | bytea | | not null | | extended | | |
user_id | uuid | | not null | | plain | | |
created_at | timestamp with time zone | | not null | | plain | | |
expires_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"sessions_pkey" PRIMARY KEY, btree (token_hash)
"sessions_user_idx" btree (user_id)
Check constraints:
"sessions_check" CHECK (expires_at > created_at)
"sessions_token_hash_check" CHECK (octet_length(token_hash) = 32)
Foreign-key constraints:
"sessions_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
Access method: heap
$ psql -c '\d+ chats'
Table "public.chats"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-----------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
id | uuid | | not null | | plain | | |
title | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
last_message_at | timestamp with time zone | | | | plain | | |
Indexes:
"chats_pkey" PRIMARY KEY, btree (id)
Check constraints:
"chats_title_check" CHECK (char_length(title) >= 1 AND char_length(title) <= 100)
Referenced by:
TABLE "chat_members" CONSTRAINT "chat_members_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
Access method: heap
$ psql -c '\d+ chat_members'
Table "public.chat_members"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-----------------+--------------------------+-----------+----------+---------+---------+-------------+--------------+-------------
chat_id | uuid | | not null | | plain | | |
user_id | uuid | | not null | | plain | | |
position | smallint | | not null | | plain | | |
chat_created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"chat_members_pkey" PRIMARY KEY, btree (chat_id, user_id)
"chat_members_user_idx" btree (user_id, chat_created_at, chat_id)
Check constraints:
"chat_members_position_check" CHECK ("position" >= 1 AND "position" <= 100)
Foreign-key constraints:
"chat_members_chat_id_fkey" FOREIGN KEY (chat_id) REFERENCES chats(id) ON DELETE CASCADE
"chat_members_user_id_fkey" FOREIGN KEY (user_id) REFERENCES users(id)
Referenced by:
TABLE "messages" CONSTRAINT "messages_chat_id_sender_id_fkey" FOREIGN KEY (chat_id, sender_id) REFERENCES chat_members(chat_id, user_id)
Access method: heap
$ psql -c '\d+ messages'
Table "public.messages"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
id | uuid | | not null | | plain | | |
chat_id | uuid | | not null | | plain | | |
sender_id | uuid | | not null | | plain | | |
text | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"messages_pkey" PRIMARY KEY, btree (id)
"messages_history_idx" btree (chat_id, created_at, id)
Check constraints:
"messages_text_check" CHECK (char_length(text) >= 1 AND char_length(text) <= 4000)
Foreign-key constraints:
"messages_chat_id_sender_id_fkey" FOREIGN KEY (chat_id, sender_id) REFERENCES chat_members(chat_id, user_id)
Access method: heap
$ psql -c '\d+ schema_migrations'
Table "public.schema_migrations"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
version | text | | not null | | extended | | |
checksum | text | | not null | | extended | | |
applied_at | timestamp with time zone | | not null | now() | plain | | |
Indexes:
"schema_migrations_pkey" PRIMARY KEY, btree (version)
Access method: heap
$ psql -c 'SELECT version, left(checksum, 12), applied_at FROM schema_migrations'
version | checksum | applied_at
-----------+--------------+------------------------------
0001_init | 9a13618f078a | 2026-10-28 17:14:47.21836+00
(1 row)
+13
View File
@@ -0,0 +1,13 @@
date: 2026-10-28T17:31:07Z commit: 6468ee2
$ git ls-files secrets .env backups volumes
(пусто: секретов, .env, дампов и volumes в Git нет)
$ git check-ignore -v secrets/database_url secrets/postgres_password .env backups/
.gitignore:5:secrets/ secrets/database_url
.gitignore:5:secrets/ secrets/postgres_password
.gitignore:2:.env .env
.gitignore:15:backups/ backups/
$ docker volume ls --filter label=com.docker.compose.project=mtusi2026lab2
DRIVER VOLUME NAME
local mtusi2026lab2_pgdata
local mtusi2026lab2_pgrestore
local mtusi2026lab2_valkeydata
+21
View File
@@ -0,0 +1,21 @@
date: 2026-10-28T17:16:20Z commit: 6468ee2
stop_grace_period: 10s, SHUTDOWN_TIMEOUT_SECONDS: 8
$ два POST /messages в работе (тело отправлено не целиком); docker compose kill --signal SIGTERM api; первому дописать тело через 1 с, второму — никогда; docker wait <api>
запрос, дописанный через 1 с после SIGTERM: HTTP/1.1 201 Created через 1.15 с
запрос, не дописанный никогда: HTTP/1.1 500 Internal Server Error через 7.24 с
остановка за 7.68 с, код завершения 0
$ docker logs <api> | записи об остановке
{"event":"Shutting down","level":"info","ts":"2026-10-28T17:16:21.580367Z"}
{"event":"Shutting down","level":"info","ts":"2026-10-28T17:16:21.597496Z"}
{"event":"Waiting for application shutdown.","level":"info","ts":"2026-10-28T17:16:21.625380Z"}
{"event":"Finished server process [13]","level":"info","ts":"2026-10-28T17:16:21.626805Z"}
{"event":"Waiting for connections to close. (CTRL+C to force quit)","level":"info","ts":"2026-10-28T17:16:21.626825Z"}
{"event":"Waiting for connections to close. (CTRL+C to force quit)","level":"info","ts":"2026-10-28T17:16:21.682577Z"}
{"event":"Waiting for application shutdown.","level":"info","ts":"2026-10-28T17:16:21.701990Z"}
{"event":"Finished server process [14]","level":"info","ts":"2026-10-28T17:16:21.708567Z"}
{"event":"Waiting for application shutdown.","level":"info","ts":"2026-10-28T17:16:22.635466Z"}
{"event":"Finished server process [16]","level":"info","ts":"2026-10-28T17:16:22.642431Z"}
{"event":"Cancel 1 running task(s), timeout graceful shutdown exceeded","level":"error","ts":"2026-10-28T17:16:28.628254Z"}
{"event":"Waiting for application shutdown.","level":"info","ts":"2026-10-28T17:16:28.628314Z"}
{"event":"Finished server process [15]","level":"info","ts":"2026-10-28T17:16:28.629034Z"}
{"event":"Shutting down: Master","level":"info","ts":"2026-10-28T17:16:28.850585Z"}
+329
View File
@@ -0,0 +1,329 @@
date: 2026-10-28T17:14:51Z commit: 6468ee2
$ make student-test PYTEST_ARGS=-v
.venv/bin/pytest -v
============================= test session starts ==============================
platform darwin -- Python 3.14.5, pytest-9.1.1, pluggy-1.6.0 -- /Users/artemkostylev/projects/learning/HL/labs/mtusi2026lab2/.venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/artemkostylev/projects/learning/HL/labs/mtusi2026lab2
configfile: pyproject.toml
testpaths: student-tests
plugins: asyncio-1.4.0, anyio-4.15.1
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collecting ... collected 234 items / 13 deselected / 221 selected
student-tests/api/test_access.py::test_outsider_gets_404_on_chat PASSED [ 0%]
student-tests/api/test_access.py::test_unknown_chat_is_indistinguishable_from_foreign PASSED [ 0%]
student-tests/api/test_access.py::test_outsider_cannot_write PASSED [ 1%]
student-tests/api/test_access.py::test_outsider_cannot_read_history PASSED [ 1%]
student-tests/api/test_access.py::test_access_checked_before_body PASSED [ 2%]
student-tests/api/test_access.py::test_chat_list_hides_foreign_chats PASSED [ 2%]
student-tests/api/test_access.py::test_403_is_never_used PASSED [ 3%]
student-tests/api/test_access.py::test_outsider_does_not_wait_for_members_lock PASSED [ 3%]
student-tests/api/test_bounded_contexts.py::test_identity_does_not_know_about_messaging PASSED [ 4%]
student-tests/api/test_bounded_contexts.py::test_domains_do_not_import_infrastructure PASSED [ 4%]
student-tests/api/test_bounded_contexts.py::test_core_layers_do_not_import_pydantic PASSED [ 4%]
student-tests/api/test_bounded_contexts.py::test_shared_knows_nothing_about_zones PASSED [ 5%]
student-tests/api/test_bounded_contexts.py::test_shared_core_is_free_of_transport PASSED [ 5%]
student-tests/api/test_bounded_contexts.py::test_shared_core_holds_only_platform PASSED [ 6%]
student-tests/api/test_bounded_contexts.py::test_shared_entrypoints_hold_only_transport PASSED [ 6%]
student-tests/api/test_bounded_contexts.py::test_every_zone_owns_its_errors_events_and_commands PASSED [ 7%]
student-tests/api/test_bounded_contexts.py::test_every_zone_owns_its_http_layer PASSED [ 7%]
student-tests/api/test_bounded_contexts.py::test_only_main_knows_both_zones PASSED [ 8%]
student-tests/api/test_bounded_contexts.py::test_application_has_no_separate_entrypoints_root PASSED [ 8%]
student-tests/api/test_bounded_contexts.py::test_shared_source_mentions_no_domain_vocabulary PASSED [ 9%]
student-tests/api/test_bounded_contexts.py::test_shared_declares_no_concrete_commands_or_events PASSED [ 9%]
student-tests/api/test_bounded_contexts.py::test_shared_has_no_test_doubles PASSED [ 9%]
student-tests/api/test_bounded_contexts.py::test_zone_errors_do_not_leak_transport_codes PASSED [ 10%]
student-tests/api/test_bounded_contexts.py::test_sql_of_each_zone_reads_only_its_tables PASSED [ 10%]
student-tests/api/test_bounded_contexts.py::test_messaging_does_not_import_identity_at_all PASSED [ 11%]
student-tests/api/test_cache.py::test_second_check_is_served_from_cache PASSED [ 11%]
student-tests/api/test_cache.py::test_logout_writes_tombstone_before_database PASSED [ 12%]
student-tests/api/test_cache.py::test_logout_rejected_by_database_changes_nothing PASSED [ 12%]
student-tests/api/test_cache.py::test_fill_racing_with_logout_does_not_revive_token PASSED [ 13%]
student-tests/api/test_cache.py::test_flushall_loses_nothing PASSED [ 13%]
student-tests/api/test_cache.py::test_unreachable_cache_is_bypassed_without_anonymous_access PASSED [ 14%]
student-tests/api/test_concurrency.py::test_hundred_messages_from_ten_clients PASSED [ 14%]
student-tests/api/test_concurrency.py::test_parallel_registration_keeps_username_unique PASSED [ 14%]
student-tests/api/test_concurrency.py::test_parallel_chat_creation_is_atomic PASSED [ 15%]
student-tests/api/test_consistency.py::test_registration_is_visible_to_chats_immediately PASSED [ 15%]
student-tests/api/test_consistency.py::test_parallel_registrations_are_all_usable_as_members PASSED [ 16%]
student-tests/api/test_consistency.py::test_rejected_registration_leaves_no_trace PASSED [ 16%]
student-tests/api/test_consistency.py::test_failed_chat_creation_rolls_back_both_tables PASSED [ 17%]
student-tests/api/test_consistency.py::test_rejected_message_does_not_enter_history PASSED [ 17%]
student-tests/api/test_consistency.py::test_confirmed_write_is_visible_to_next_read PASSED [ 18%]
student-tests/api/test_consistency.py::test_parallel_writes_across_zones_keep_counts_consistent PASSED [ 18%]
student-tests/api/test_consistency.py::test_chat_membership_survives_parallel_reads_and_writes PASSED [ 19%]
student-tests/api/test_events.py::test_event_has_no_message_text PASSED [ 19%]
student-tests/api/test_events.py::test_every_subscriber_receives_event PASSED [ 19%]
student-tests/api/test_events.py::test_failing_subscriber_does_not_block_others PASSED [ 20%]
student-tests/api/test_events.py::test_queue_overflow_drops_events_without_raising PASSED [ 20%]
student-tests/api/test_events.py::test_publication_does_not_delay_response PASSED [ 21%]
student-tests/api/test_events.py::test_null_logger_hides_everything PASSED [ 21%]
student-tests/api/test_migrations.py::test_migrations_are_ordered_and_versioned PASSED [ 22%]
student-tests/api/test_migrations.py::test_rerun_changes_nothing PASSED [ 22%]
student-tests/api/test_migrations.py::test_changed_migration_is_refused PASSED [ 23%]
student-tests/api/test_migrations.py::test_sender_must_be_member_even_bypassing_api PASSED [ 23%]
student-tests/api/test_migrations.py::test_database_name_argument_replaces_only_the_database PASSED [ 23%]
student-tests/api/test_negative.py::test_malformed_json PASSED [ 24%]
student-tests/api/test_negative.py::test_unexpected_field PASSED [ 24%]
student-tests/api/test_negative.py::test_wrong_types PASSED [ 25%]
student-tests/api/test_negative.py::test_invalid_registration[body0] PASSED [ 25%]
student-tests/api/test_negative.py::test_invalid_registration[body1] PASSED [ 26%]
student-tests/api/test_negative.py::test_invalid_registration[body2] PASSED [ 26%]
student-tests/api/test_negative.py::test_invalid_registration[body3] PASSED [ 27%]
student-tests/api/test_negative.py::test_invalid_registration[body4] PASSED [ 27%]
student-tests/api/test_negative.py::test_invalid_registration[body5] PASSED [ 28%]
student-tests/api/test_negative.py::test_invalid_registration[body6] PASSED [ 28%]
student-tests/api/test_negative.py::test_invalid_registration[body7] PASSED [ 28%]
student-tests/api/test_negative.py::test_invalid_registration[body8] PASSED [ 29%]
student-tests/api/test_negative.py::test_invalid_registration[body9] PASSED [ 29%]
student-tests/api/test_negative.py::test_invalid_registration[body10] PASSED [ 30%]
student-tests/api/test_negative.py::test_duplicate_username PASSED [ 30%]
student-tests/api/test_negative.py::test_missing_identity PASSED [ 31%]
student-tests/api/test_negative.py::test_invalid_bearer[] PASSED [ 31%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer] PASSED [ 32%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer ] PASSED [ 32%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer not a token] PASSED [ 33%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 33%]
student-tests/api/test_negative.py::test_invalid_bearer[Token abcdef] PASSED [ 33%]
student-tests/api/test_negative.py::test_invalid_bearer[11111111-1111-4111-8111-111111111111] PASSED [ 34%]
student-tests/api/test_negative.py::test_user_id_header_alone_is_ignored PASSED [ 34%]
student-tests/api/test_negative.py::test_identity_checked_before_body PASSED [ 35%]
student-tests/api/test_negative.py::test_empty_message_rejected PASSED [ 35%]
student-tests/api/test_negative.py::test_long_message_rejected PASSED [ 36%]
student-tests/api/test_negative.py::test_sender_id_not_accepted PASSED [ 36%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body0] PASSED [ 37%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body1] PASSED [ 37%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body2] PASSED [ 38%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body3] PASSED [ 38%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body4] PASSED [ 38%]
student-tests/api/test_negative.py::test_invalid_chat_creation[body5] PASSED [ 39%]
student-tests/api/test_negative.py::test_creator_must_be_member PASSED [ 39%]
student-tests/api/test_negative.py::test_unknown_member_rejected PASSED [ 40%]
student-tests/api/test_negative.py::test_bad_chat_id_in_path PASSED [ 40%]
student-tests/api/test_operability.py::test_health_needs_no_identity PASSED [ 41%]
student-tests/api/test_operability.py::test_every_response_carries_request_id PASSED [ 41%]
student-tests/api/test_operability.py::test_client_request_id_is_preserved PASSED [ 42%]
student-tests/api/test_operability.py::test_unknown_public_route_is_404 PASSED [ 42%]
student-tests/api/test_operability.py::test_unknown_protected_route_needs_identity PASSED [ 42%]
student-tests/api/test_operability.py::test_method_not_allowed_is_hidden PASSED [ 43%]
student-tests/api/test_operability.py::test_logs_do_not_contain_message_text PASSED [ 43%]
student-tests/api/test_operability.py::test_log_lines_are_json PASSED [ 44%]
student-tests/api/test_operability.py::test_body_limit_returns_413 PASSED [ 44%]
student-tests/api/test_operability.py::test_chunked_body_is_limited_too PASSED [ 45%]
student-tests/api/test_operability.py::test_ready_turns_unavailable_without_database PASSED [ 45%]
student-tests/api/test_operability.py::test_protected_request_is_503_not_401_without_database PASSED [ 46%]
student-tests/api/test_operability.py::test_state_survives_new_process PASSED [ 46%]
student-tests/api/test_operability.py::test_logs_do_not_contain_credentials PASSED [ 47%]
student-tests/api/test_pagination.py::test_full_walk_has_no_gaps_or_repeats PASSED [ 47%]
student-tests/api/test_pagination.py::test_limit_may_change_between_pages PASSED [ 47%]
student-tests/api/test_pagination.py::test_last_page_closes_history PASSED [ 48%]
student-tests/api/test_pagination.py::test_cursor_is_shared_between_members PASSED [ 48%]
student-tests/api/test_pagination.py::test_cursor_from_another_chat_is_rejected PASSED [ 49%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[garbage] PASSED [ 49%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[1.2.3.4] PASSED [ 50%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[%20] PASSED [ 50%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[] PASSED [ 51%]
student-tests/api/test_pagination.py::test_limit_out_of_range[0] PASSED [ 51%]
student-tests/api/test_pagination.py::test_limit_out_of_range[-1] PASSED [ 52%]
student-tests/api/test_pagination.py::test_limit_out_of_range[101] PASSED [ 52%]
student-tests/api/test_pagination.py::test_limit_out_of_range[abc] PASSED [ 52%]
student-tests/api/test_pagination.py::test_limit_out_of_range[1.5] PASSED [ 53%]
student-tests/api/test_pagination.py::test_limit_out_of_range[] PASSED [ 53%]
student-tests/api/test_pagination.py::test_default_limit_is_50 PASSED [ 54%]
student-tests/api/test_pagination.py::test_unknown_query_parameter_is_ignored PASSED [ 54%]
student-tests/api/test_pagination.py::test_chat_list_pagination PASSED [ 55%]
student-tests/api/test_pool.py::test_exhausted_pool_answers_503_in_bounded_time PASSED [ 55%]
student-tests/api/test_pool.py::test_statement_timeout_is_set_on_connections PASSED [ 56%]
student-tests/api/test_sessions.py::test_login_returns_session_for_registered_user PASSED [ 56%]
student-tests/api/test_sessions.py::test_registration_response_hides_password PASSED [ 57%]
student-tests/api/test_sessions.py::test_password_is_stored_as_argon2id PASSED [ 57%]
student-tests/api/test_sessions.py::test_session_stores_only_token_digest PASSED [ 57%]
student-tests/api/test_sessions.py::test_wrong_password_and_unknown_user_look_the_same PASSED [ 58%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers0] PASSED [ 58%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers1] PASSED [ 59%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers2] PASSED [ 59%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers3] PASSED [ 60%]
student-tests/api/test_sessions.py::test_password_with_colon_logs_in PASSED [ 60%]
student-tests/api/test_sessions.py::test_login_with_body_is_rejected PASSED [ 61%]
student-tests/api/test_sessions.py::test_basic_on_business_endpoint_gets_bearer_challenge PASSED [ 61%]
student-tests/api/test_sessions.py::test_user_id_header_does_not_override_owner PASSED [ 61%]
student-tests/api/test_sessions.py::test_authentication_precedes_validation PASSED [ 62%]
student-tests/api/test_sessions.py::test_logout_revokes_only_current_session PASSED [ 62%]
student-tests/api/test_sessions.py::test_short_ttl_session_expires PASSED [ 63%]
student-tests/api/test_sessions.py::test_expired_sessions_are_purged_on_next_login PASSED [ 63%]
student-tests/api/test_sessions.py::test_chat_routes_require_bearer PASSED [ 64%]
student-tests/api/test_timeout.py::test_timeout_returns_unavailable_error_body PASSED [ 64%]
student-tests/api/test_timeout.py::test_timeout_does_not_break_following_requests PASSED [ 65%]
student-tests/api/test_timeout.py::test_timeout_is_logged_without_message_text PASSED [ 65%]
student-tests/api/test_timeout.py::test_normal_request_is_not_affected_by_timeout PASSED [ 66%]
student-tests/api/test_timeout.py::test_slow_event_handler_does_not_trigger_timeout PASSED [ 66%]
student-tests/api/test_timeout.py::test_healthcheck_stays_fast PASSED [ 66%]
student-tests/api/test_wire_format.py::test_created_at_is_rfc3339_utc[whole-second] PASSED [ 67%]
student-tests/api/test_wire_format.py::test_created_at_is_rfc3339_utc[microseconds] PASSED [ 67%]
student-tests/unit/test_authentication.py::test_basic_splits_on_first_colon PASSED [ 68%]
student-tests/unit/test_authentication.py::test_basic_decodes_utf8_password PASSED [ 68%]
student-tests/unit/test_authentication.py::test_basic_scheme_is_case_insensitive PASSED [ 69%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[] PASSED [ 69%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic] PASSED [ 70%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic ] PASSED [ 70%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic !!!not-base64!!!] PASSED [ 71%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic YWxpY2U] PASSED [ 71%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic bm8tY29sb24taGVyZQ==] PASSED [ 71%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic 0LDQu9C40YHQsDrQv9Cw0YDQvtC70Yw=] PASSED [ 72%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Basic YWxpY2U6//4=] PASSED [ 72%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Bearer YWxpY2U6c2VjcmV0] PASSED [ 73%]
student-tests/unit/test_authentication.py::test_bearer_accepts_token68 PASSED [ 73%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[] PASSED [ 74%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer] PASSED [ 74%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer ] PASSED [ 75%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer a b] PASSED [ 75%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Basic abc] PASSED [ 76%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 76%]
student-tests/unit/test_authentication.py::test_bearer_rejects_oversized_token PASSED [ 76%]
student-tests/unit/test_authentication.py::test_challenge_depends_only_on_path PASSED [ 77%]
student-tests/unit/test_cursor.py::test_roundtrip_preserves_key PASSED [ 77%]
student-tests/unit/test_cursor.py::test_cursor_is_opaque PASSED [ 78%]
student-tests/unit/test_cursor.py::test_cursor_from_another_scope_is_rejected PASSED [ 78%]
student-tests/unit/test_cursor.py::test_forged_cursor_is_rejected PASSED [ 79%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[] PASSED [ 79%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[garbage] PASSED [ 80%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.2.3] PASSED [ 80%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[2.1.2.3] PASSED [ 80%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.notanumber.ff.AAAA] PASSED [ 81%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.1.zz.AAAA] PASSED [ 81%]
student-tests/unit/test_cursor.py::test_tampered_payload_is_rejected PASSED [ 82%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[ab] PASSED [ 82%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] PASSED [ 83%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[Alice] PASSED [ 83%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice-01] PASSED [ 84%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[\u0430\u043b\u0438\u0441\u0430] PASSED [ 84%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[] PASSED [ 85%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[a b] PASSED [ 85%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice\n] PASSED [ 85%]
student-tests/unit/test_domain.py::test_username_rejects_invalid[alice\r\n] PASSED [ 86%]
student-tests/unit/test_domain.py::test_username_accepts_valid[abc] PASSED [ 86%]
student-tests/unit/test_domain.py::test_username_accepts_valid[a_b_9] PASSED [ 87%]
student-tests/unit/test_domain.py::test_username_accepts_valid[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] PASSED [ 87%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[] PASSED [ 88%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[ ] PASSED [ 88%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[\t\n] PASSED [ 89%]
student-tests/unit/test_domain.py::test_display_name_rejects_invalid[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 89%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[] PASSED [ 90%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[ ] PASSED [ 90%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[xxxxxxxxxxx] PASSED [ 90%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 91%]
student-tests/unit/test_domain.py::test_password_rejects_invalid[\t\t\t\t\t\t\t\t\t\t\t\t] PASSED [ 91%]
student-tests/unit/test_domain.py::test_password_counts_code_points[xxxxxxxxxxxx] PASSED [ 92%]
student-tests/unit/test_domain.py::test_password_counts_code_points[\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f\u043f] PASSED [ 92%]
student-tests/unit/test_domain.py::test_password_counts_code_points[\u043f\u0430\u0440\u043e\u043b\u044c:\u0441:\u0434\u0432\u043e\u0435\u0442\u043e\u0447\u0438\u0435\u043c] PASSED [ 93%]
student-tests/unit/test_domain.py::test_password_counts_code_points[\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b\U0001f44b] PASSED [ 93%]
student-tests/unit/test_domain.py::test_password_is_not_printed PASSED [ 94%]
student-tests/unit/test_domain.py::test_session_token_is_opaque_and_stored_as_digest PASSED [ 94%]
student-tests/unit/test_domain.py::test_session_tokens_are_unique PASSED [ 95%]
student-tests/unit/test_domain.py::test_message_text_counts_code_points_not_bytes PASSED [ 95%]
student-tests/unit/test_domain.py::test_message_text_rejects_blank PASSED [ 95%]
student-tests/unit/test_domain.py::test_chat_requires_creator_in_members PASSED [ 96%]
student-tests/unit/test_domain.py::test_chat_rejects_duplicate_members PASSED [ 96%]
student-tests/unit/test_domain.py::test_chat_rejects_more_than_hundred_members PASSED [ 97%]
student-tests/unit/test_domain.py::test_outsider_cannot_post PASSED [ 97%]
student-tests/unit/test_domain.py::test_post_never_moves_history_back PASSED [ 98%]
student-tests/unit/test_domain.py::test_post_keeps_clock_when_it_is_ahead PASSED [ 98%]
student-tests/unit/test_domain.py::test_post_validates_membership_before_text PASSED [ 99%]
student-tests/unit/test_domain.py::test_user_registration_emits_event PASSED [ 99%]
student-tests/unit/test_domain.py::test_clock_is_strictly_increasing PASSED [100%]
===================== 221 passed, 13 deselected in 14.97s ======================
$ make student-test PYTEST_ARGS="-v -k 'rolls_back'"
student-tests/api/test_consistency.py::test_failed_chat_creation_rolls_back_both_tables PASSED [100%]
====================== 1 passed, 233 deselected in 1.58s =======================
$ make student-test PYTEST_ARGS="-v -k 'sessions or bearer'"
student-tests/api/test_negative.py::test_invalid_bearer[] PASSED [ 2%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer] PASSED [ 5%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer ] PASSED [ 8%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer not a token] PASSED [ 11%]
student-tests/api/test_negative.py::test_invalid_bearer[Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 14%]
student-tests/api/test_negative.py::test_invalid_bearer[Token abcdef] PASSED [ 17%]
student-tests/api/test_negative.py::test_invalid_bearer[11111111-1111-4111-8111-111111111111] PASSED [ 20%]
student-tests/api/test_sessions.py::test_login_returns_session_for_registered_user PASSED [ 23%]
student-tests/api/test_sessions.py::test_registration_response_hides_password PASSED [ 26%]
student-tests/api/test_sessions.py::test_password_is_stored_as_argon2id PASSED [ 29%]
student-tests/api/test_sessions.py::test_session_stores_only_token_digest PASSED [ 32%]
student-tests/api/test_sessions.py::test_wrong_password_and_unknown_user_look_the_same PASSED [ 35%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers0] PASSED [ 38%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers1] PASSED [ 41%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers2] PASSED [ 44%]
student-tests/api/test_sessions.py::test_login_without_valid_basic[headers3] PASSED [ 47%]
student-tests/api/test_sessions.py::test_password_with_colon_logs_in PASSED [ 50%]
student-tests/api/test_sessions.py::test_login_with_body_is_rejected PASSED [ 52%]
student-tests/api/test_sessions.py::test_basic_on_business_endpoint_gets_bearer_challenge PASSED [ 55%]
student-tests/api/test_sessions.py::test_user_id_header_does_not_override_owner PASSED [ 58%]
student-tests/api/test_sessions.py::test_authentication_precedes_validation PASSED [ 61%]
student-tests/api/test_sessions.py::test_logout_revokes_only_current_session PASSED [ 64%]
student-tests/api/test_sessions.py::test_short_ttl_session_expires PASSED [ 67%]
student-tests/api/test_sessions.py::test_expired_sessions_are_purged_on_next_login PASSED [ 70%]
student-tests/api/test_sessions.py::test_chat_routes_require_bearer PASSED [ 73%]
student-tests/unit/test_authentication.py::test_basic_rejects_malformed[Bearer YWxpY2U6c2VjcmV0] PASSED [ 76%]
student-tests/unit/test_authentication.py::test_bearer_accepts_token68 PASSED [ 79%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[] PASSED [ 82%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer] PASSED [ 85%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer ] PASSED [ 88%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Bearer a b] PASSED [ 91%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[Basic abc] PASSED [ 94%]
student-tests/unit/test_authentication.py::test_bearer_rejects_malformed[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 97%]
student-tests/unit/test_authentication.py::test_bearer_rejects_oversized_token PASSED [100%]
====================== 34 passed, 200 deselected in 5.00s ======================
$ make student-test PYTEST_ARGS="-v -k 'expire or logout'"
student-tests/api/test_cache.py::test_logout_writes_tombstone_before_database PASSED [ 16%]
student-tests/api/test_cache.py::test_logout_rejected_by_database_changes_nothing PASSED [ 33%]
student-tests/api/test_cache.py::test_fill_racing_with_logout_does_not_revive_token PASSED [ 50%]
student-tests/api/test_sessions.py::test_logout_revokes_only_current_session PASSED [ 66%]
student-tests/api/test_sessions.py::test_short_ttl_session_expires PASSED [ 83%]
student-tests/api/test_sessions.py::test_expired_sessions_are_purged_on_next_login PASSED [100%]
====================== 6 passed, 228 deselected in 4.83s =======================
$ make student-test PYTEST_ARGS="-v -k 'user_id'"
student-tests/api/test_negative.py::test_user_id_header_alone_is_ignored PASSED [ 50%]
student-tests/api/test_sessions.py::test_user_id_header_does_not_override_owner PASSED [100%]
====================== 2 passed, 232 deselected in 1.72s =======================
$ make student-test PYTEST_ARGS="-v -k 'outsider'"
student-tests/api/test_access.py::test_outsider_gets_404_on_chat PASSED [ 20%]
student-tests/api/test_access.py::test_outsider_cannot_write PASSED [ 40%]
student-tests/api/test_access.py::test_outsider_cannot_read_history PASSED [ 60%]
student-tests/api/test_access.py::test_outsider_does_not_wait_for_members_lock PASSED [ 80%]
student-tests/unit/test_domain.py::test_outsider_cannot_post PASSED [100%]
====================== 5 passed, 229 deselected in 1.98s =======================
$ make student-test PYTEST_ARGS="-v -k 'cursor'"
student-tests/api/test_pagination.py::test_cursor_is_shared_between_members PASSED [ 5%]
student-tests/api/test_pagination.py::test_cursor_from_another_chat_is_rejected PASSED [ 11%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[garbage] PASSED [ 17%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[1.2.3.4] PASSED [ 23%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[%20] PASSED [ 29%]
student-tests/api/test_pagination.py::test_broken_cursor_is_rejected[] PASSED [ 35%]
student-tests/unit/test_cursor.py::test_roundtrip_preserves_key PASSED [ 41%]
student-tests/unit/test_cursor.py::test_cursor_is_opaque PASSED [ 47%]
student-tests/unit/test_cursor.py::test_cursor_from_another_scope_is_rejected PASSED [ 52%]
student-tests/unit/test_cursor.py::test_forged_cursor_is_rejected PASSED [ 58%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[] PASSED [ 64%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[garbage] PASSED [ 70%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.2.3] PASSED [ 76%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[2.1.2.3] PASSED [ 82%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.notanumber.ff.AAAA] PASSED [ 88%]
student-tests/unit/test_cursor.py::test_broken_cursor_is_rejected[1.1.zz.AAAA] PASSED [ 94%]
student-tests/unit/test_cursor.py::test_tampered_payload_is_rejected PASSED [100%]
====================== 17 passed, 217 deselected in 2.07s ======================
$ make student-test PYTEST_ARGS="-v -k 'body_limit or chunked'"
student-tests/api/test_operability.py::test_body_limit_returns_413 PASSED [ 50%]
student-tests/api/test_operability.py::test_chunked_body_is_limited_too PASSED [100%]
====================== 2 passed, 232 deselected in 1.54s =======================
$ make student-test PYTEST_ARGS="-v -k 'cache'"
student-tests/api/test_cache.py::test_second_check_is_served_from_cache PASSED [ 16%]
student-tests/api/test_cache.py::test_logout_writes_tombstone_before_database PASSED [ 33%]
student-tests/api/test_cache.py::test_logout_rejected_by_database_changes_nothing PASSED [ 50%]
student-tests/api/test_cache.py::test_fill_racing_with_logout_does_not_revive_token PASSED [ 66%]
student-tests/api/test_cache.py::test_flushall_loses_nothing PASSED [ 83%]
student-tests/api/test_cache.py::test_unreachable_cache_is_bypassed_without_anonymous_access PASSED [100%]
====================== 6 passed, 228 deselected in 2.35s =======================
$ make student-test PYTEST_ARGS="-v -k 'pool'"
student-tests/api/test_pool.py::test_exhausted_pool_answers_503_in_bounded_time PASSED [ 50%]
student-tests/api/test_pool.py::test_statement_timeout_is_set_on_connections PASSED [100%]
====================== 2 passed, 232 deselected in 1.87s =======================
File diff suppressed because it is too large Load Diff
+552
View File
@@ -0,0 +1,552 @@
date: 2026-10-28T17:18:31.130Z commit: 6468ee2 17.11
EXPLAIN (ANALYZE, BUFFERS) при plan_cache_mode = force_custom_plan
=== none | largest (284708 сообщений) | first | тёплый кэш
Limit (cost=35863.74..35869.69 rows=51 width=176) (actual time=19.687..21.080 rows=51 loops=1)
Buffers: shared hit=14320 read=11464
-> Gather Merge (cost=35863.74..63557.67 rows=237360 width=176) (actual time=19.686..21.077 rows=51 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=14320 read=11464
-> Sort (cost=34863.71..35160.41 rows=118680 width=176) (actual time=18.751..18.753 rows=51 loops=3)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 38kB
Buffers: shared hit=14320 read=11464
Worker 0: Sort Method: top-N heapsort Memory: 38kB
Worker 1: Sort Method: top-N heapsort Memory: 38kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=118680 width=176) (actual time=0.013..14.715 rows=94903 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Rows Removed by Filter: 238428
Buffers: shared hit=14232 read=11464
Planning Time: 0.059 ms
Execution Time: 21.103 ms
=== none | largest (284708 сообщений) | keyset_deep | тёплый кэш
Limit (cost=34387.32..34393.27 rows=51 width=176) (actual time=17.737..18.764 rows=51 loops=1)
Buffers: shared hit=702 read=25024
-> Gather Merge (cost=34387.32..37182.85 rows=23960 width=176) (actual time=17.736..18.761 rows=51 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=702 read=25024
-> Sort (cost=33387.29..33417.24 rows=11980 width=176) (actual time=16.550..16.551 rows=34 loops=3)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 38kB
Buffers: shared hit=702 read=25024
Worker 0: Sort Method: top-N heapsort Memory: 38kB
Worker 1: Sort Method: top-N heapsort Memory: 38kB
-> Parallel Seq Scan on messages (cost=0.00..32987.62 rows=11980 width=176) (actual time=5.403..16.125 rows=9490 loops=3)
Filter: ((chat_id = '00000000-0000-7000-8000-000000000001'::uuid) AND (ROW(created_at, id) > ROW('2026-01-27 23:59:58.179187+00'::timestamp with time zone, '00000001-0000-7000-8002-00000003e8ed'::uuid)))
Rows Removed by Filter: 323841
Buffers: shared hit=672 read=25024
Planning Time: 0.083 ms
Execution Time: 18.778 ms
=== none | largest (284708 сообщений) | offset_deep | тёплый кэш
Limit (cost=79744.03..79744.15 rows=1 width=176) (actual time=58.869..60.326 rows=51 loops=1)
Buffers: shared hit=760 read=25024, temp read=6161 written=6660
-> Gather Merge (cost=52050.10..79744.03 rows=237360 width=176) (actual time=26.697..55.317 rows=256288 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=760 read=25024, temp read=6161 written=6660
-> Sort (cost=51050.07..51346.77 rows=118680 width=176) (actual time=25.251..31.125 rows=85598 loops=3)
Sort Key: created_at, id
Sort Method: external merge Disk: 18360kB
Buffers: shared hit=760 read=25024, temp read=6161 written=6660
Worker 0: Sort Method: external merge Disk: 16632kB
Worker 1: Sort Method: external merge Disk: 18144kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=118680 width=176) (actual time=0.018..14.215 rows=94903 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Rows Removed by Filter: 238428
Buffers: shared hit=672 read=25024
Planning Time: 0.074 ms
Execution Time: 60.862 ms
=== none | chat_50 (1761 сообщений) | first | тёплый кэш
Limit (cost=31923.34..31929.29 rows=51 width=176) (actual time=13.382..14.353 rows=51 loops=1)
Buffers: shared hit=760 read=25024
-> Gather Merge (cost=31923.34..32056.35 rows=1140 width=176) (actual time=13.381..14.350 rows=51 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=760 read=25024
-> Sort (cost=30923.31..30924.74 rows=570 width=176) (actual time=12.427..12.429 rows=51 loops=3)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 38kB
Buffers: shared hit=760 read=25024
Worker 0: Sort Method: top-N heapsort Memory: 38kB
Worker 1: Sort Method: top-N heapsort Memory: 38kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=570 width=176) (actual time=10.425..12.342 rows=587 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Rows Removed by Filter: 332744
Buffers: shared hit=672 read=25024
Planning Time: 0.070 ms
Execution Time: 14.366 ms
=== none | chat_50 (1761 сообщений) | keyset_deep | тёплый кэш
Limit (cost=33989.34..33995.29 rows=51 width=176) (actual time=14.321..15.468 rows=51 loops=1)
Buffers: shared hit=702 read=25024
-> Gather Merge (cost=33989.34..34002.87 rows=116 width=176) (actual time=14.321..15.465 rows=51 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=702 read=25024
-> Sort (cost=32989.31..32989.46 rows=58 width=176) (actual time=13.344..13.345 rows=17 loops=3)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 38kB
Buffers: shared hit=702 read=25024
Worker 0: Sort Method: quicksort Memory: 25kB
Worker 1: Sort Method: quicksort Memory: 25kB
-> Parallel Seq Scan on messages (cost=0.00..32987.62 rows=58 width=176) (actual time=12.630..13.319 rows=59 loops=3)
Filter: ((chat_id = '00000000-0000-7000-8000-000000000032'::uuid) AND (ROW(created_at, id) > ROW('2026-01-27 23:37:55.298126+00'::timestamp with time zone, '00000032-0000-7000-8002-000000000630'::uuid)))
Rows Removed by Filter: 333272
Buffers: shared hit=672 read=25024
Planning Time: 0.067 ms
Execution Time: 15.485 ms
=== none | chat_50 (1761 сообщений) | offset_deep | тёплый кэш
Limit (cost=32063.42..32063.54 rows=1 width=176) (actual time=15.830..16.873 rows=51 loops=1)
Buffers: shared hit=760 read=25024
-> Gather Merge (cost=31930.41..32063.42 rows=1140 width=176) (actual time=15.600..16.837 rows=1635 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=760 read=25024
-> Sort (cost=30930.39..30931.81 rows=570 width=176) (actual time=14.374..14.389 rows=587 loops=3)
Sort Key: created_at, id
Sort Method: quicksort Memory: 185kB
Buffers: shared hit=760 read=25024
Worker 0: Sort Method: quicksort Memory: 186kB
Worker 1: Sort Method: quicksort Memory: 157kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=570 width=176) (actual time=11.973..14.250 rows=587 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Rows Removed by Filter: 332744
Buffers: shared hit=672 read=25024
Planning Time: 0.096 ms
Execution Time: 16.898 ms
=== none | smallest (36 сообщений) | first | тёплый кэш
Limit (cost=31906.17..31912.12 rows=51 width=176) (actual time=13.734..14.652 rows=36 loops=1)
Buffers: shared hit=760 read=25024
-> Gather Merge (cost=31906.17..31920.63 rows=124 width=176) (actual time=13.733..14.648 rows=36 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=760 read=25024
-> Sort (cost=30906.14..30906.30 rows=62 width=176) (actual time=12.758..12.758 rows=12 loops=3)
Sort Key: created_at, id
Sort Method: quicksort Memory: 26kB
Buffers: shared hit=760 read=25024
Worker 0: Sort Method: quicksort Memory: 25kB
Worker 1: Sort Method: quicksort Memory: 32kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=62 width=176) (actual time=12.709..12.709 rows=12 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Rows Removed by Filter: 333319
Buffers: shared hit=672 read=25024
Planning Time: 0.066 ms
Execution Time: 14.661 ms
=== none | smallest (36 сообщений) | keyset_deep | тёплый кэш
Limit (cost=33987.74..33989.37 rows=14 width=176) (actual time=15.901..16.837 rows=4 loops=1)
Buffers: shared hit=702 read=25024
-> Gather Merge (cost=33987.74..33989.37 rows=14 width=176) (actual time=15.900..16.836 rows=4 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=702 read=25024
-> Sort (cost=32987.71..32987.73 rows=7 width=176) (actual time=14.760..14.760 rows=1 loops=3)
Sort Key: created_at, id
Sort Method: quicksort Memory: 25kB
Buffers: shared hit=702 read=25024
Worker 0: Sort Method: quicksort Memory: 26kB
Worker 1: Sort Method: quicksort Memory: 25kB
-> Parallel Seq Scan on messages (cost=0.00..32987.62 rows=7 width=176) (actual time=14.740..14.741 rows=1 loops=3)
Filter: ((chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid) AND (ROW(created_at, id) > ROW('2026-01-27 16:00:00+00'::timestamp with time zone, '000003e8-0000-7000-8002-000000000020'::uuid)))
Rows Removed by Filter: 333330
Buffers: shared hit=672 read=25024
Planning Time: 0.106 ms
Execution Time: 16.849 ms
=== none | smallest (36 сообщений) | offset_deep | тёплый кэш
Limit (cost=31909.90..31915.85 rows=51 width=176) (actual time=13.819..14.716 rows=4 loops=1)
Buffers: shared hit=760 read=25024
-> Gather Merge (cost=31906.17..31920.63 rows=124 width=176) (actual time=13.806..14.706 rows=36 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=760 read=25024
-> Sort (cost=30906.14..30906.30 rows=62 width=176) (actual time=12.679..12.679 rows=12 loops=3)
Sort Key: created_at, id
Sort Method: quicksort Memory: 26kB
Buffers: shared hit=760 read=25024
Worker 0: Sort Method: quicksort Memory: 25kB
Worker 1: Sort Method: quicksort Memory: 32kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=62 width=176) (actual time=12.627..12.628 rows=12 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Rows Removed by Filter: 333319
Buffers: shared hit=672 read=25024
Planning Time: 0.075 ms
Execution Time: 14.727 ms
=== chat_id | largest (284708 сообщений) | first | тёплый кэш
Limit (cost=16437.64..16443.59 rows=51 width=176) (actual time=10.754..11.724 rows=51 loops=1)
Buffers: shared hit=7866
-> Gather Merge (cost=16437.64..43836.62 rows=234832 width=176) (actual time=10.754..11.722 rows=51 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=7866
-> Sort (cost=15437.62..15731.16 rows=117416 width=176) (actual time=9.806..9.807 rows=51 loops=3)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 38kB
Buffers: shared hit=7866
Worker 0: Sort Method: top-N heapsort Memory: 38kB
Worker 1: Sort Method: top-N heapsort Memory: 38kB
-> Parallel Index Scan using track_chat_idx on messages (cost=0.42..11520.37 rows=117416 width=176) (actual time=0.006..5.561 rows=94903 loops=3)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Buffers: shared hit=7836
Planning Time: 0.068 ms
Execution Time: 11.738 ms
=== chat_id | largest (284708 сообщений) | keyset_deep | тёплый кэш
Limit (cost=13498.08..13504.03 rows=51 width=176) (actual time=6.926..7.877 rows=51 loops=1)
Buffers: shared hit=7848
-> Gather Merge (cost=13498.08..16230.14 rows=23416 width=176) (actual time=6.925..7.874 rows=51 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=7848
-> Sort (cost=12498.05..12527.32 rows=11708 width=176) (actual time=5.778..5.779 rows=51 loops=3)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 38kB
Buffers: shared hit=7848
Worker 0: Sort Method: top-N heapsort Memory: 38kB
Worker 1: Sort Method: top-N heapsort Memory: 38kB
-> Parallel Index Scan using track_chat_idx on messages (cost=0.42..12107.45 rows=11708 width=176) (actual time=4.661..5.364 rows=9490 loops=3)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Filter: (ROW(created_at, id) > ROW('2026-01-27 23:59:58.179187+00'::timestamp with time zone, '00000001-0000-7000-8002-00000003e8ed'::uuid))
Rows Removed by Filter: 85412
Buffers: shared hit=7818
Planning Time: 0.087 ms
Execution Time: 7.900 ms
=== chat_id | largest (284708 сообщений) | offset_deep | тёплый кэш
Limit (cost=59841.05..59841.16 rows=1 width=176) (actual time=56.297..59.389 rows=51 loops=1)
Buffers: shared hit=7849, temp read=6290 written=6665
-> Gather Merge (cost=32442.07..59841.05 rows=234832 width=176) (actual time=20.056..54.066 rows=256288 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=7849, temp read=6290 written=6665
-> Sort (cost=31442.04..31735.58 rows=117416 width=176) (actual time=18.834..24.515 rows=85603 loops=3)
Sort Key: created_at, id
Sort Method: external merge Disk: 19728kB
Buffers: shared hit=7849, temp read=6290 written=6665
Worker 0: Sort Method: external merge Disk: 16616kB
Worker 1: Sort Method: external merge Disk: 16824kB
-> Parallel Index Scan using track_chat_idx on messages (cost=0.42..11520.37 rows=117416 width=176) (actual time=0.014..6.727 rows=94903 loops=3)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Buffers: shared hit=7819
Planning Time: 0.104 ms
Execution Time: 60.257 ms
=== chat_id | chat_50 (1761 сообщений) | first | тёплый кэш
Limit (cost=139.43..139.56 rows=51 width=176) (actual time=0.197..0.200 rows=51 loops=1)
Buffers: shared hit=50
-> Sort (cost=139.43..143.60 rows=1667 width=176) (actual time=0.197..0.198 rows=51 loops=1)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 38kB
Buffers: shared hit=50
-> Index Scan using track_chat_idx on messages (cost=0.42..83.82 rows=1667 width=176) (actual time=0.010..0.109 rows=1761 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Buffers: shared hit=50
Planning Time: 0.064 ms
Execution Time: 0.211 ms
=== chat_id | chat_50 (1761 сообщений) | keyset_deep | тёплый кэш
Limit (cost=97.73..97.85 rows=51 width=176) (actual time=0.095..0.098 rows=51 loops=1)
Buffers: shared hit=50
-> Sort (cost=97.73..98.14 rows=167 width=176) (actual time=0.095..0.097 rows=51 loops=1)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 38kB
Buffers: shared hit=50
-> Index Scan using track_chat_idx on messages (cost=0.42..92.15 rows=167 width=176) (actual time=0.072..0.083 rows=177 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Filter: (ROW(created_at, id) > ROW('2026-01-27 23:37:55.298126+00'::timestamp with time zone, '00000032-0000-7000-8002-000000000630'::uuid))
Rows Removed by Filter: 1584
Buffers: shared hit=50
Planning Time: 0.024 ms
Execution Time: 0.105 ms
=== chat_id | chat_50 (1761 сообщений) | offset_deep | тёплый кэш
Limit (cost=176.99..177.12 rows=51 width=176) (actual time=0.300..0.304 rows=51 loops=1)
Buffers: shared hit=50
-> Sort (cost=173.03..177.20 rows=1667 width=176) (actual time=0.232..0.270 rows=1635 loops=1)
Sort Key: created_at, id
Sort Method: quicksort Memory: 503kB
Buffers: shared hit=50
-> Index Scan using track_chat_idx on messages (cost=0.42..83.82 rows=1667 width=176) (actual time=0.004..0.086 rows=1761 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Buffers: shared hit=50
Planning Time: 0.022 ms
Execution Time: 0.320 ms
=== chat_id | smallest (36 сообщений) | first | тёплый кэш
Limit (cost=19.13..19.25 rows=51 width=176) (actual time=0.012..0.014 rows=36 loops=1)
Buffers: shared hit=5
-> Sort (cost=19.13..19.50 rows=151 width=176) (actual time=0.011..0.012 rows=36 loops=1)
Sort Key: created_at, id
Sort Method: quicksort Memory: 34kB
Buffers: shared hit=5
-> Index Scan using track_chat_idx on messages (cost=0.42..14.09 rows=151 width=176) (actual time=0.005..0.007 rows=36 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Buffers: shared hit=5
Planning Time: 0.037 ms
Execution Time: 0.023 ms
=== chat_id | smallest (36 сообщений) | keyset_deep | тёплый кэш
Limit (cost=15.19..15.23 rows=17 width=176) (actual time=0.012..0.013 rows=4 loops=1)
Buffers: shared hit=5
-> Sort (cost=15.19..15.23 rows=17 width=176) (actual time=0.012..0.012 rows=4 loops=1)
Sort Key: created_at, id
Sort Method: quicksort Memory: 26kB
Buffers: shared hit=5
-> Index Scan using track_chat_idx on messages (cost=0.42..14.84 rows=17 width=176) (actual time=0.008..0.008 rows=4 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Filter: (ROW(created_at, id) > ROW('2026-01-27 16:00:00+00'::timestamp with time zone, '000003e8-0000-7000-8002-000000000020'::uuid))
Rows Removed by Filter: 32
Buffers: shared hit=5
Planning Time: 0.076 ms
Execution Time: 0.021 ms
=== chat_id | smallest (36 сообщений) | offset_deep | тёплый кэш
Limit (cost=19.63..19.76 rows=51 width=176) (actual time=0.017..0.018 rows=4 loops=1)
Buffers: shared hit=5
-> Sort (cost=19.55..19.93 rows=151 width=176) (actual time=0.016..0.017 rows=36 loops=1)
Sort Key: created_at, id
Sort Method: quicksort Memory: 34kB
Buffers: shared hit=5
-> Index Scan using track_chat_idx on messages (cost=0.42..14.09 rows=151 width=176) (actual time=0.008..0.010 rows=36 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Buffers: shared hit=5
Planning Time: 0.070 ms
Execution Time: 0.026 ms
=== created_at_id | largest (284708 сообщений) | first | тёплый кэш
Limit (cost=0.42..25.26 rows=51 width=176) (actual time=0.010..0.031 rows=51 loops=1)
Buffers: shared hit=113
-> Index Scan using track_time_idx on messages (cost=0.42..139575.12 rows=286631 width=176) (actual time=0.010..0.028 rows=51 loops=1)
Filter: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Rows Removed by Filter: 73
Buffers: shared hit=113
Planning Time: 0.053 ms
Execution Time: 0.039 ms
=== created_at_id | largest (284708 сообщений) | keyset_deep | тёплый кэш
Limit (cost=0.42..188.15 rows=51 width=176) (actual time=0.027..0.052 rows=51 loops=1)
Buffers: shared hit=251
-> Index Scan using track_time_idx on messages (cost=0.42..106136.95 rows=28835 width=176) (actual time=0.027..0.049 rows=51 loops=1)
Index Cond: (ROW(created_at, id) > ROW('2026-01-27 23:59:58.179187+00'::timestamp with time zone, '00000001-0000-7000-8002-00000003e8ed'::uuid))
Filter: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Rows Removed by Filter: 200
Buffers: shared hit=251
Planning Time: 0.035 ms
Execution Time: 0.058 ms
=== created_at_id | largest (284708 сообщений) | offset_deep | тёплый кэш
Limit (cost=80050.68..80050.80 rows=1 width=176) (actual time=59.207..60.934 rows=51 loops=1)
Buffers: shared hit=807 read=24977, temp read=6253 written=6661
-> Gather Merge (cost=52181.74..80050.68 rows=238860 width=176) (actual time=26.737..55.792 rows=256288 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=807 read=24977, temp read=6253 written=6661
-> Sort (cost=51181.71..51480.29 rows=119430 width=176) (actual time=25.560..31.143 rows=85575 loops=3)
Sort Key: created_at, id
Sort Method: external merge Disk: 18736kB
Buffers: shared hit=807 read=24977, temp read=6253 written=6661
Worker 0: Sort Method: external merge Disk: 16960kB
Worker 1: Sort Method: external merge Disk: 17440kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=119430 width=176) (actual time=0.016..14.329 rows=94903 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Rows Removed by Filter: 238428
Buffers: shared hit=719 read=24977
Planning Time: 0.097 ms
Execution Time: 61.612 ms
=== created_at_id | chat_50 (1761 сообщений) | first | тёплый кэш
Limit (cost=0.42..3813.12 rows=51 width=176) (actual time=0.065..3.258 rows=51 loops=1)
Buffers: shared hit=28010
-> Index Scan using track_time_idx on messages (cost=0.42..139575.12 rows=1867 width=176) (actual time=0.065..3.254 rows=51 loops=1)
Filter: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Rows Removed by Filter: 28460
Buffers: shared hit=28010
Planning Time: 0.053 ms
Execution Time: 3.268 ms
=== created_at_id | chat_50 (1761 сообщений) | keyset_deep | тёплый кэш
Limit (cost=0.42..28646.45 rows=51 width=176) (actual time=0.099..3.240 rows=51 loops=1)
Buffers: shared hit=28414
-> Index Scan using track_time_idx on messages (cost=0.42..106159.22 rows=189 width=176) (actual time=0.099..3.236 rows=51 loops=1)
Index Cond: (ROW(created_at, id) > ROW('2026-01-27 23:37:55.298126+00'::timestamp with time zone, '00000032-0000-7000-8002-000000000630'::uuid))
Filter: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Rows Removed by Filter: 28907
Buffers: shared hit=28414
Planning Time: 0.038 ms
Execution Time: 3.251 ms
=== created_at_id | chat_50 (1761 сообщений) | offset_deep | тёплый кэш
Limit (cost=32123.22..32123.34 rows=1 width=176) (actual time=14.536..15.478 rows=51 loops=1)
Buffers: shared hit=2431 read=23353
-> Gather Merge (cost=31941.68..32123.22 rows=1556 width=176) (actual time=14.355..15.443 rows=1635 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=2431 read=23353
-> Sort (cost=30941.65..30943.60 rows=778 width=176) (actual time=13.244..13.265 rows=587 loops=3)
Sort Key: created_at, id
Sort Method: quicksort Memory: 185kB
Buffers: shared hit=2431 read=23353
Worker 0: Sort Method: quicksort Memory: 157kB
Worker 1: Sort Method: quicksort Memory: 186kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=778 width=176) (actual time=10.936..13.123 rows=587 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Rows Removed by Filter: 332744
Buffers: shared hit=2343 read=23353
Planning Time: 0.099 ms
Execution Time: 15.503 ms
=== created_at_id | smallest (36 сообщений) | first | тёплый кэш
Limit (cost=31906.17..31912.12 rows=51 width=176) (actual time=13.930..15.035 rows=36 loops=1)
Buffers: shared hit=760 read=25024
-> Gather Merge (cost=31906.17..31920.63 rows=124 width=176) (actual time=13.929..15.033 rows=36 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=760 read=25024
-> Sort (cost=30906.14..30906.30 rows=62 width=176) (actual time=12.920..12.920 rows=12 loops=3)
Sort Key: created_at, id
Sort Method: quicksort Memory: 32kB
Buffers: shared hit=760 read=25024
Worker 0: Sort Method: quicksort Memory: 26kB
Worker 1: Sort Method: quicksort Memory: 25kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=62 width=176) (actual time=12.870..12.871 rows=12 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Rows Removed by Filter: 333319
Buffers: shared hit=672 read=25024
Planning Time: 0.091 ms
Execution Time: 15.047 ms
=== created_at_id | smallest (36 сообщений) | keyset_deep | тёплый кэш
Limit (cost=30560.11..30561.75 rows=14 width=176) (actual time=5.528..6.445 rows=4 loops=1)
Buffers: shared hit=4524
-> Gather Merge (cost=30560.11..30561.75 rows=14 width=176) (actual time=5.528..6.444 rows=4 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=4524
-> Sort (cost=29560.09..29560.11 rows=7 width=176) (actual time=4.643..4.643 rows=1 loops=3)
Sort Key: created_at, id
Sort Method: quicksort Memory: 25kB
Buffers: shared hit=4524
Worker 0: Sort Method: quicksort Memory: 25kB
Worker 1: Sort Method: quicksort Memory: 26kB
-> Parallel Bitmap Heap Scan on messages (cost=3049.84..29559.99 rows=7 width=176) (actual time=4.627..4.627 rows=1 loops=3)
Recheck Cond: (ROW(created_at, id) > ROW('2026-01-27 16:00:00+00'::timestamp with time zone, '000003e8-0000-7000-8002-000000000020'::uuid))
Filter: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Rows Removed by Filter: 37186
Heap Blocks: exact=1618
Buffers: shared hit=4494
-> Bitmap Index Scan on track_time_idx (cost=0.00..3049.84 rows=111655 width=0) (actual time=3.125..3.125 rows=111561 loops=1)
Index Cond: (ROW(created_at, id) > ROW('2026-01-27 16:00:00+00'::timestamp with time zone, '000003e8-0000-7000-8002-000000000020'::uuid))
Buffers: shared hit=553
Planning Time: 0.069 ms
Execution Time: 6.464 ms
=== created_at_id | smallest (36 сообщений) | offset_deep | тёплый кэш
Limit (cost=31909.90..31915.85 rows=51 width=176) (actual time=14.001..15.088 rows=4 loops=1)
Buffers: shared hit=4605 read=21179
-> Gather Merge (cost=31906.17..31920.63 rows=124 width=176) (actual time=13.998..15.086 rows=36 loops=1)
Workers Planned: 2
Workers Launched: 2
Buffers: shared hit=4605 read=21179
-> Sort (cost=30906.14..30906.30 rows=62 width=176) (actual time=13.028..13.029 rows=12 loops=3)
Sort Key: created_at, id
Sort Method: quicksort Memory: 25kB
Buffers: shared hit=4605 read=21179
Worker 0: Sort Method: quicksort Memory: 32kB
Worker 1: Sort Method: quicksort Memory: 26kB
-> Parallel Seq Scan on messages (cost=0.00..30904.30 rows=62 width=176) (actual time=12.975..12.976 rows=12 loops=3)
Filter: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Rows Removed by Filter: 333319
Buffers: shared hit=4517 read=21179
Planning Time: 0.090 ms
Execution Time: 15.100 ms
=== chat_id_created_at_id | largest (284708 сообщений) | first | тёплый кэш
Limit (cost=0.42..11.49 rows=51 width=176) (actual time=0.008..0.014 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_history_idx on messages (cost=0.42..62439.90 rows=287698 width=176) (actual time=0.008..0.011 rows=51 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Buffers: shared hit=5
Planning Time: 0.035 ms
Execution Time: 0.020 ms
=== chat_id_created_at_id | largest (284708 сообщений) | keyset_deep | тёплый кэш
Limit (cost=0.42..61.18 rows=51 width=176) (actual time=0.009..0.014 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_history_idx on messages (cost=0.42..33769.77 rows=28348 width=176) (actual time=0.008..0.011 rows=51 loops=1)
Index Cond: ((chat_id = '00000000-0000-7000-8000-000000000001'::uuid) AND (ROW(created_at, id) > ROW('2026-01-27 23:59:58.179187+00'::timestamp with time zone, '00000001-0000-7000-8002-00000003e8ed'::uuid)))
Buffers: shared hit=5
Planning Time: 0.050 ms
Execution Time: 0.023 ms
=== chat_id_created_at_id | largest (284708 сообщений) | offset_deep | тёплый кэш
Limit (cost=55611.87..55622.94 rows=51 width=176) (actual time=21.642..21.647 rows=51 loops=1)
Buffers: shared hit=9012
-> Index Scan using messages_history_idx on messages (cost=0.42..62439.90 rows=287698 width=176) (actual time=0.011..16.618 rows=256288 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000001'::uuid)
Buffers: shared hit=9012
Planning Time: 0.078 ms
Execution Time: 21.666 ms
=== chat_id_created_at_id | chat_50 (1761 сообщений) | first | тёплый кэш
Limit (cost=0.42..90.76 rows=51 width=176) (actual time=0.006..0.011 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_history_idx on messages (cost=0.42..2303.01 rows=1300 width=176) (actual time=0.006..0.008 rows=51 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Buffers: shared hit=5
Planning Time: 0.034 ms
Execution Time: 0.018 ms
=== chat_id_created_at_id | chat_50 (1761 сообщений) | keyset_deep | тёплый кэш
Limit (cost=0.42..93.83 rows=51 width=176) (actual time=0.006..0.013 rows=51 loops=1)
Buffers: shared hit=6
-> Index Scan using messages_history_idx on messages (cost=0.42..236.70 rows=129 width=176) (actual time=0.006..0.011 rows=51 loops=1)
Index Cond: ((chat_id = '00000000-0000-7000-8000-000000000032'::uuid) AND (ROW(created_at, id) > ROW('2026-01-27 23:37:55.298126+00'::timestamp with time zone, '00000032-0000-7000-8002-000000000630'::uuid)))
Buffers: shared hit=6
Planning Time: 0.049 ms
Execution Time: 0.020 ms
=== chat_id_created_at_id | chat_50 (1761 сообщений) | offset_deep | тёплый кэш
Limit (cost=2303.01..2304.79 rows=1 width=176) (actual time=0.158..0.164 rows=51 loops=1)
Buffers: shared hit=64
-> Index Scan using messages_history_idx on messages (cost=0.42..2303.01 rows=1300 width=176) (actual time=0.005..0.125 rows=1635 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-000000000032'::uuid)
Buffers: shared hit=64
Planning Time: 0.031 ms
Execution Time: 0.170 ms
=== chat_id_created_at_id | smallest (36 сообщений) | first | тёплый кэш
Limit (cost=0.42..94.71 rows=51 width=176) (actual time=0.006..0.010 rows=36 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_history_idx on messages (cost=0.42..272.19 rows=147 width=176) (actual time=0.006..0.009 rows=36 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Buffers: shared hit=5
Planning Time: 0.044 ms
Execution Time: 0.016 ms
=== chat_id_created_at_id | smallest (36 сообщений) | keyset_deep | тёплый кэш
Limit (cost=0.42..35.00 rows=16 width=176) (actual time=0.005..0.006 rows=4 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_history_idx on messages (cost=0.42..35.00 rows=16 width=176) (actual time=0.005..0.006 rows=4 loops=1)
Index Cond: ((chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid) AND (ROW(created_at, id) > ROW('2026-01-27 16:00:00+00'::timestamp with time zone, '000003e8-0000-7000-8002-000000000020'::uuid)))
Buffers: shared hit=4
Planning Time: 0.039 ms
Execution Time: 0.012 ms
=== chat_id_created_at_id | smallest (36 сообщений) | offset_deep | тёплый кэш
Limit (cost=59.58..153.87 rows=51 width=176) (actual time=0.008..0.009 rows=4 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_history_idx on messages (cost=0.42..272.19 rows=147 width=176) (actual time=0.005..0.007 rows=36 loops=1)
Index Cond: (chat_id = '00000000-0000-7000-8000-0000000003e8'::uuid)
Buffers: shared hit=5
Planning Time: 0.040 ms
Execution Time: 0.015 ms
+608
View File
@@ -0,0 +1,608 @@
{
"meta": {
"date": "2026-10-28T17:28:48.636Z",
"commit": "6468ee2",
"postgres": "17.11"
},
"method": "время начала и конца pg_dump — clock_timestamp() PostgreSQL источника, теми же часами, что created_at маркеров",
"runs": [
{
"messages": 100011,
"attempt": 1,
"dataset": {
"messages": 100011,
"chats": 1000,
"zipf_s": 1.3,
"largest": 28471,
"chat_50": 176,
"smallest": 4,
"largest_share": 0.2847,
"top10_share": 0.6507,
"table_bytes": 20922368,
"seed_seconds": 1.1
},
"dump": {
"file": "backups/track-100011.dump",
"bytes": 1685570,
"dump_seconds": 0.15,
"dump_started": "2026-10-28T17:28:52.450145+00:00",
"dump_finished": "2026-10-28T17:28:52.597283+00:00"
},
"instance": {
"volume": "mtusi2026lab2_pgrestore",
"volume_created": "2026-10-28T17:28:53Z"
},
"restore": {
"pre-data_seconds": 0.2,
"data_seconds": 0.35,
"post-data_seconds": 0.22,
"new_instance_seconds": 1.3,
"verify_seconds": 0.19,
"rto_seconds": 2.26
},
"checks": {
"users": true,
"chats": true,
"chat_members": true,
"messages": true,
"migrations": true,
"per_chat_counts_md5": true,
"history_md5_largest": true,
"history_md5_chat_50": true,
"history_md5_smallest": true,
"sample_rows": true,
"sample_md5": true,
"indexes": true,
"constraints": true
},
"all_checks_passed": true,
"source": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 100011,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "b06aba9e2766adec5cc81ea748132e15",
"history_md5_largest": "b810fd78d33a0ba7063788f5a0575bac",
"history_md5_chat_50": "5a9e32b500653af6d41a2e9e601ea154",
"history_md5_smallest": "c1827adf4c8667bc1706113288d6bef6",
"sample_rows": 90,
"sample_md5": "3f0fbfe474b498ff751f283bc2171c62",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 75,
"last_marker_at": "2026-10-28T17:28:53.231617+00:00"
},
"restored": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 100011,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "b06aba9e2766adec5cc81ea748132e15",
"history_md5_largest": "b810fd78d33a0ba7063788f5a0575bac",
"history_md5_chat_50": "5a9e32b500653af6d41a2e9e601ea154",
"history_md5_smallest": "c1827adf4c8667bc1706113288d6bef6",
"sample_rows": 90,
"sample_md5": "3f0fbfe474b498ff751f283bc2171c62",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 41,
"last_marker_at": "2026-10-28T17:28:52.449345+00:00"
},
"rpo": {
"markers_in_source": 75,
"markers_in_backup": 41,
"markers_lost": 34,
"markers_lost_while_dump_was_running": 6,
"last_marker_in_backup": "2026-10-28T17:28:52.449345+00:00",
"dump_started": "2026-10-28T17:28:52.450145+00:00",
"dump_finished": "2026-10-28T17:28:52.597283+00:00"
}
},
{
"messages": 100011,
"attempt": 2,
"dataset": {
"messages": 100011,
"chats": 1000,
"zipf_s": 1.3,
"largest": 28471,
"chat_50": 176,
"smallest": 4,
"largest_share": 0.2847,
"top10_share": 0.6507,
"table_bytes": 20922368,
"seed_seconds": 1.1
},
"dump": {
"file": "backups/track-100011.dump",
"bytes": 1685752,
"dump_seconds": 0.15,
"dump_started": "2026-10-28T17:28:57.537217+00:00",
"dump_finished": "2026-10-28T17:28:57.682906+00:00"
},
"instance": {
"volume": "mtusi2026lab2_pgrestore",
"volume_created": "2026-10-28T17:28:59Z"
},
"restore": {
"pre-data_seconds": 0.14,
"data_seconds": 0.35,
"post-data_seconds": 0.23,
"new_instance_seconds": 1.26,
"verify_seconds": 0.19,
"rto_seconds": 2.17
},
"checks": {
"users": true,
"chats": true,
"chat_members": true,
"messages": true,
"migrations": true,
"per_chat_counts_md5": true,
"history_md5_largest": true,
"history_md5_chat_50": true,
"history_md5_smallest": true,
"sample_rows": true,
"sample_md5": true,
"indexes": true,
"constraints": true
},
"all_checks_passed": true,
"source": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 100011,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "b06aba9e2766adec5cc81ea748132e15",
"history_md5_largest": "b810fd78d33a0ba7063788f5a0575bac",
"history_md5_chat_50": "5a9e32b500653af6d41a2e9e601ea154",
"history_md5_smallest": "c1827adf4c8667bc1706113288d6bef6",
"sample_rows": 90,
"sample_md5": "3f0fbfe474b498ff751f283bc2171c62",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 77,
"last_marker_at": "2026-10-28T17:28:58.333567+00:00"
},
"restored": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 100011,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "b06aba9e2766adec5cc81ea748132e15",
"history_md5_largest": "b810fd78d33a0ba7063788f5a0575bac",
"history_md5_chat_50": "5a9e32b500653af6d41a2e9e601ea154",
"history_md5_smallest": "c1827adf4c8667bc1706113288d6bef6",
"sample_rows": 90,
"sample_md5": "3f0fbfe474b498ff751f283bc2171c62",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 43,
"last_marker_at": "2026-10-28T17:28:57.534265+00:00"
},
"rpo": {
"markers_in_source": 77,
"markers_in_backup": 43,
"markers_lost": 34,
"markers_lost_while_dump_was_running": 6,
"last_marker_in_backup": "2026-10-28T17:28:57.534265+00:00",
"dump_started": "2026-10-28T17:28:57.537217+00:00",
"dump_finished": "2026-10-28T17:28:57.682906+00:00"
}
},
{
"messages": 100011,
"attempt": 3,
"dataset": {
"messages": 100011,
"chats": 1000,
"zipf_s": 1.3,
"largest": 28471,
"chat_50": 176,
"smallest": 4,
"largest_share": 0.2847,
"top10_share": 0.6507,
"table_bytes": 20922368,
"seed_seconds": 1.1
},
"dump": {
"file": "backups/track-100011.dump",
"bytes": 1685825,
"dump_seconds": 0.15,
"dump_started": "2026-10-28T17:29:02.671832+00:00",
"dump_finished": "2026-10-28T17:29:02.819966+00:00"
},
"instance": {
"volume": "mtusi2026lab2_pgrestore",
"volume_created": "2026-10-28T17:29:04Z"
},
"restore": {
"pre-data_seconds": 0.16,
"data_seconds": 0.34,
"post-data_seconds": 0.22,
"new_instance_seconds": 1.26,
"verify_seconds": 0.19,
"rto_seconds": 2.17
},
"checks": {
"users": true,
"chats": true,
"chat_members": true,
"messages": true,
"migrations": true,
"per_chat_counts_md5": true,
"history_md5_largest": true,
"history_md5_chat_50": true,
"history_md5_smallest": true,
"sample_rows": true,
"sample_md5": true,
"indexes": true,
"constraints": true
},
"all_checks_passed": true,
"source": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 100011,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "b06aba9e2766adec5cc81ea748132e15",
"history_md5_largest": "b810fd78d33a0ba7063788f5a0575bac",
"history_md5_chat_50": "5a9e32b500653af6d41a2e9e601ea154",
"history_md5_smallest": "c1827adf4c8667bc1706113288d6bef6",
"sample_rows": 90,
"sample_md5": "3f0fbfe474b498ff751f283bc2171c62",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 76,
"last_marker_at": "2026-10-28T17:29:03.454521+00:00"
},
"restored": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 100011,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "b06aba9e2766adec5cc81ea748132e15",
"history_md5_largest": "b810fd78d33a0ba7063788f5a0575bac",
"history_md5_chat_50": "5a9e32b500653af6d41a2e9e601ea154",
"history_md5_smallest": "c1827adf4c8667bc1706113288d6bef6",
"sample_rows": 90,
"sample_md5": "3f0fbfe474b498ff751f283bc2171c62",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 43,
"last_marker_at": "2026-10-28T17:29:02.670566+00:00"
},
"rpo": {
"markers_in_source": 76,
"markers_in_backup": 43,
"markers_lost": 33,
"markers_lost_while_dump_was_running": 7,
"last_marker_in_backup": "2026-10-28T17:29:02.670566+00:00",
"dump_started": "2026-10-28T17:29:02.671832+00:00",
"dump_finished": "2026-10-28T17:29:02.819966+00:00"
}
},
{
"messages": 999993,
"attempt": 1,
"dataset": {
"messages": 999993,
"chats": 1000,
"zipf_s": 1.3,
"largest": 284708,
"chat_50": 1761,
"smallest": 36,
"largest_share": 0.2847,
"top10_share": 0.6508,
"table_bytes": 210591744,
"seed_seconds": 8.6
},
"dump": {
"file": "backups/track-999993.dump",
"bytes": 15400057,
"dump_seconds": 1.03,
"dump_started": "2026-10-28T17:29:17.903031+00:00",
"dump_finished": "2026-10-28T17:29:18.937636+00:00"
},
"instance": {
"volume": "mtusi2026lab2_pgrestore",
"volume_created": "2026-10-28T17:29:20Z"
},
"restore": {
"pre-data_seconds": 0.17,
"data_seconds": 2.16,
"post-data_seconds": 0.89,
"new_instance_seconds": 1.27,
"verify_seconds": 0.83,
"rto_seconds": 5.32
},
"checks": {
"users": true,
"chats": true,
"chat_members": true,
"messages": true,
"migrations": true,
"per_chat_counts_md5": true,
"history_md5_largest": true,
"history_md5_chat_50": true,
"history_md5_smallest": true,
"sample_rows": true,
"sample_md5": true,
"indexes": true,
"constraints": true
},
"all_checks_passed": true,
"source": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 999993,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "9c9de2270a5df6c52d3c9fa78e788d52",
"history_md5_largest": "d2e65041f85c2b3918b6ed41f90ae912",
"history_md5_chat_50": "507411ae207ce077b612fb47ddd69de8",
"history_md5_smallest": "9c119064d444208cdec773d9dd82c9d6",
"sample_rows": 1005,
"sample_md5": "7ce2113e18546b9191eda7c66c5fcf10",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 118,
"last_marker_at": "2026-10-28T17:29:19.571073+00:00"
},
"restored": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 999993,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "9c9de2270a5df6c52d3c9fa78e788d52",
"history_md5_largest": "d2e65041f85c2b3918b6ed41f90ae912",
"history_md5_chat_50": "507411ae207ce077b612fb47ddd69de8",
"history_md5_smallest": "9c119064d444208cdec773d9dd82c9d6",
"sample_rows": 1005,
"sample_md5": "7ce2113e18546b9191eda7c66c5fcf10",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 42,
"last_marker_at": "2026-10-28T17:29:17.887529+00:00"
},
"rpo": {
"markers_in_source": 118,
"markers_in_backup": 42,
"markers_lost": 76,
"markers_lost_while_dump_was_running": 48,
"last_marker_in_backup": "2026-10-28T17:29:17.887529+00:00",
"dump_started": "2026-10-28T17:29:17.903031+00:00",
"dump_finished": "2026-10-28T17:29:18.937636+00:00"
}
},
{
"messages": 999993,
"attempt": 2,
"dataset": {
"messages": 999993,
"chats": 1000,
"zipf_s": 1.3,
"largest": 284708,
"chat_50": 1761,
"smallest": 36,
"largest_share": 0.2847,
"top10_share": 0.6508,
"table_bytes": 210591744,
"seed_seconds": 8.6
},
"dump": {
"file": "backups/track-999993.dump",
"bytes": 15400357,
"dump_seconds": 1.04,
"dump_started": "2026-10-28T17:29:27.895177+00:00",
"dump_finished": "2026-10-28T17:29:28.932480+00:00"
},
"instance": {
"volume": "mtusi2026lab2_pgrestore",
"volume_created": "2026-10-28T17:29:31Z"
},
"restore": {
"pre-data_seconds": 0.16,
"data_seconds": 2.17,
"post-data_seconds": 0.91,
"new_instance_seconds": 1.27,
"verify_seconds": 0.84,
"rto_seconds": 5.35
},
"checks": {
"users": true,
"chats": true,
"chat_members": true,
"messages": true,
"migrations": true,
"per_chat_counts_md5": true,
"history_md5_largest": true,
"history_md5_chat_50": true,
"history_md5_smallest": true,
"sample_rows": true,
"sample_md5": true,
"indexes": true,
"constraints": true
},
"all_checks_passed": true,
"source": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 999993,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "9c9de2270a5df6c52d3c9fa78e788d52",
"history_md5_largest": "d2e65041f85c2b3918b6ed41f90ae912",
"history_md5_chat_50": "507411ae207ce077b612fb47ddd69de8",
"history_md5_smallest": "9c119064d444208cdec773d9dd82c9d6",
"sample_rows": 1005,
"sample_md5": "7ce2113e18546b9191eda7c66c5fcf10",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 118,
"last_marker_at": "2026-10-28T17:29:29.591525+00:00"
},
"restored": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 999993,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "9c9de2270a5df6c52d3c9fa78e788d52",
"history_md5_largest": "d2e65041f85c2b3918b6ed41f90ae912",
"history_md5_chat_50": "507411ae207ce077b612fb47ddd69de8",
"history_md5_smallest": "9c119064d444208cdec773d9dd82c9d6",
"sample_rows": 1005,
"sample_md5": "7ce2113e18546b9191eda7c66c5fcf10",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 44,
"last_marker_at": "2026-10-28T17:29:27.894289+00:00"
},
"rpo": {
"markers_in_source": 118,
"markers_in_backup": 44,
"markers_lost": 74,
"markers_lost_while_dump_was_running": 46,
"last_marker_in_backup": "2026-10-28T17:29:27.894289+00:00",
"dump_started": "2026-10-28T17:29:27.895177+00:00",
"dump_finished": "2026-10-28T17:29:28.932480+00:00"
}
},
{
"messages": 999993,
"attempt": 3,
"dataset": {
"messages": 999993,
"chats": 1000,
"zipf_s": 1.3,
"largest": 284708,
"chat_50": 1761,
"smallest": 36,
"largest_share": 0.2847,
"top10_share": 0.6508,
"table_bytes": 210591744,
"seed_seconds": 8.6
},
"dump": {
"file": "backups/track-999993.dump",
"bytes": 15400375,
"dump_seconds": 1.05,
"dump_started": "2026-10-28T17:29:38.014765+00:00",
"dump_finished": "2026-10-28T17:29:39.062119+00:00"
},
"instance": {
"volume": "mtusi2026lab2_pgrestore",
"volume_created": "2026-10-28T17:29:41Z"
},
"restore": {
"pre-data_seconds": 0.16,
"data_seconds": 2.13,
"post-data_seconds": 0.91,
"new_instance_seconds": 1.27,
"verify_seconds": 0.84,
"rto_seconds": 5.31
},
"checks": {
"users": true,
"chats": true,
"chat_members": true,
"messages": true,
"migrations": true,
"per_chat_counts_md5": true,
"history_md5_largest": true,
"history_md5_chat_50": true,
"history_md5_smallest": true,
"sample_rows": true,
"sample_md5": true,
"indexes": true,
"constraints": true
},
"all_checks_passed": true,
"source": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 999993,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "9c9de2270a5df6c52d3c9fa78e788d52",
"history_md5_largest": "d2e65041f85c2b3918b6ed41f90ae912",
"history_md5_chat_50": "507411ae207ce077b612fb47ddd69de8",
"history_md5_smallest": "9c119064d444208cdec773d9dd82c9d6",
"sample_rows": 1005,
"sample_md5": "7ce2113e18546b9191eda7c66c5fcf10",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 118,
"last_marker_at": "2026-10-28T17:29:39.704206+00:00"
},
"restored": {
"users": 2000,
"chats": 1000,
"chat_members": 2000,
"messages": 999993,
"migrations": "0001_init:9a13618f078a",
"per_chat_counts_md5": "9c9de2270a5df6c52d3c9fa78e788d52",
"history_md5_largest": "d2e65041f85c2b3918b6ed41f90ae912",
"history_md5_chat_50": "507411ae207ce077b612fb47ddd69de8",
"history_md5_smallest": "9c119064d444208cdec773d9dd82c9d6",
"sample_rows": 1005,
"sample_md5": "7ce2113e18546b9191eda7c66c5fcf10",
"indexes": "chat_members_pkey,chat_members_user_idx,chats_pkey,messages_history_idx,messages_pkey,schema_migrations_pkey,sessions_pkey,sessions_user_idx,users_pkey,users_username_key",
"constraints": 19,
"markers": 43,
"last_marker_at": "2026-10-28T17:29:38.013596+00:00"
},
"rpo": {
"markers_in_source": 118,
"markers_in_backup": 43,
"markers_lost": 75,
"markers_lost_while_dump_was_running": 47,
"last_marker_in_backup": "2026-10-28T17:29:38.013596+00:00",
"dump_started": "2026-10-28T17:29:38.014765+00:00",
"dump_finished": "2026-10-28T17:29:39.062119+00:00"
}
}
],
"summary": [
{
"messages": 100011,
"repeats": 3,
"rto_median_seconds": 2.17,
"rto_range_seconds": [
2.17,
2.26
],
"new_instance_median_seconds": 1.26,
"all_checks_passed": true,
"markers_lost_while_dump_was_running": [
6,
6,
7
]
},
{
"messages": 999993,
"repeats": 3,
"rto_median_seconds": 5.32,
"rto_range_seconds": [
5.31,
5.35
],
"new_instance_median_seconds": 1.27,
"all_checks_passed": true,
"markers_lost_while_dump_was_running": [
48,
46,
47
]
}
]
}
+66
View File
@@ -0,0 +1,66 @@
date: 2026-10-28T17:18:31.130Z commit: 6468ee2 17.11
dataset: {"messages": 999993, "chats": 1000, "zipf_s": 1.3, "largest": 284708, "chat_50": 1761, "smallest": 36, "largest_share": 0.2847, "top10_share": 0.6508, "table_bytes": 210591744, "seed_seconds": 8.1}
variant | chat | query | warm median ms | cold median ms | hit/read (cold) | rows scanned | plan
none | largest | first | 21.986 | 19.778 | 81/25703 | 999993 | Limit > Gather Merge > Sort > Seq Scan
none | largest | keyset_deep | 17.603 | 16.681 | 28/25698 | 999993 | Limit > Gather Merge > Sort > Seq Scan
none | largest | offset_deep | 61.335 | 58.804 | 80/25704 | 999993 | Limit > Gather Merge > Sort > Seq Scan
none | chat_50 | first | 14.505 | 14.59 | 80/25704 | 999993 | Limit > Gather Merge > Sort > Seq Scan
none | chat_50 | keyset_deep | 15.863 | 16.096 | 28/25698 | 999993 | Limit > Gather Merge > Sort > Seq Scan
none | chat_50 | offset_deep | 16.791 | 16.125 | 81/25703 | 999993 | Limit > Gather Merge > Sort > Seq Scan
none | smallest | first | 14.383 | 15.032 | 80/25704 | 999993 | Limit > Gather Merge > Sort > Seq Scan
none | smallest | keyset_deep | 16.15 | 16.268 | 28/25698 | 999993 | Limit > Gather Merge > Sort > Seq Scan
none | smallest | offset_deep | 14.286 | 14.403 | 81/25703 | 999993 | Limit > Gather Merge > Sort > Seq Scan
chat_id | largest | first | 12.189 | 16.475 | 259/7608 | 284709 | Limit > Gather Merge > Sort > Index Scan(track_chat_idx)
chat_id | largest | keyset_deep | 8.294 | 12.737 | 255/7606 | 284706 | Limit > Gather Merge > Sort > Index Scan(track_chat_idx)
chat_id | largest | offset_deep | 55.767 | 63.201 | 240/7606 | 284709 | Limit > Gather Merge > Sort > Index Scan(track_chat_idx)
chat_id | chat_50 | first | 0.185 | 0.276 | 0/50 | 1761 | Limit > Sort > Index Scan(track_chat_idx)
chat_id | chat_50 | keyset_deep | 0.12 | 0.211 | 0/50 | 1761 | Limit > Sort > Index Scan(track_chat_idx)
chat_id | chat_50 | offset_deep | 0.344 | 0.447 | 0/50 | 1761 | Limit > Sort > Index Scan(track_chat_idx)
chat_id | smallest | first | 0.024 | 0.05 | 0/5 | 36 | Limit > Sort > Index Scan(track_chat_idx)
chat_id | smallest | keyset_deep | 0.016 | 0.034 | 0/5 | 36 | Limit > Sort > Index Scan(track_chat_idx)
chat_id | smallest | offset_deep | 0.018 | 0.037 | 0/5 | 36 | Limit > Sort > Index Scan(track_chat_idx)
created_at_id | largest | first | 0.035 | 0.092 | 88/25 | 124 | Limit > Index Scan(track_time_idx)
created_at_id | largest | keyset_deep | 0.065 | 0.325 | 103/148 | 251 | Limit > Index Scan(track_time_idx)
created_at_id | largest | offset_deep | 63.071 | 63.074 | 80/25704 | 999993 | Limit > Gather Merge > Sort > Seq Scan
created_at_id | chat_50 | first | 3.133 | 6.748 | 26118/1892 | 28511 | Limit > Index Scan(track_time_idx)
created_at_id | chat_50 | keyset_deep | 3.226 | 7.116 | 26501/1913 | 28958 | Limit > Index Scan(track_time_idx)
created_at_id | chat_50 | offset_deep | 15.902 | 14.655 | 79/25705 | 999993 | Limit > Gather Merge > Sort > Seq Scan
created_at_id | smallest | first | 14.654 | 14.474 | 80/25704 | 999993 | Limit > Gather Merge > Sort > Seq Scan
created_at_id | smallest | keyset_deep | 6.563 | 10.028 | 28/4496 | 223122 | Limit > Gather Merge > Sort > Bitmap Heap Scan > Bitmap Index Scan(track_time_idx)
created_at_id | smallest | offset_deep | 15.407 | 14.45 | 81/25703 | 999993 | Limit > Gather Merge > Sort > Seq Scan
chat_id_created_at_id | largest | first | 0.022 | 0.036 | 0/5 | 51 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | largest | keyset_deep | 0.024 | 0.035 | 0/5 | 51 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | largest | offset_deep | 19.956 | 33.396 | 559/8453 | 256288 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | chat_50 | first | 0.019 | 0.03 | 0/5 | 51 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | chat_50 | keyset_deep | 0.021 | 0.038 | 0/6 | 51 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | chat_50 | offset_deep | 0.157 | 0.25 | 7/57 | 1635 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | smallest | first | 0.017 | 0.03 | 0/5 | 36 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | smallest | keyset_deep | 0.012 | 0.024 | 0/4 | 4 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | smallest | offset_deep | 0.017 | 0.028 | 0/5 | 36 | Limit > Index Scan(messages_history_idx)
order | variant | commit | build s | table MB | indexes MB | tps median [min..max] | latency ms | WAL bytes/insert | WAL records/insert | FPI/insert | postgres CPU % | postgres MiB
1 | none | sync | 0.0 | 200.8 | 30.1 | 9455.4 [9314.0..9502.3] | 0.423 | 1511 | 6.7 | 0.128 | 272.13 | 281.6
1 | none | async | 0.0 | 200.8 | 30.1 | 12680.5 [12393.0..12819.5] | 0.315 | 1205 | 6.05 | 0.096 | 353.0 | 187.6
2 | chat_id | sync | 0.27 | 200.8 | 44.6 | 9233.4 [7941.2..9603.8] | 0.433 | 1588 | 7.06 | 0.135 | 273.39 | 188.1
2 | chat_id | async | 0.27 | 200.8 | 44.6 | 12496.8 [10742.6..12721.2] | 0.32 | 1303 | 7.04 | 0.1 | 352.39 | 189.5
3 | created_at_id | sync | 0.28 | 200.8 | 76.4 | 9179.6 [9055.4..9539.9] | 0.436 | 1586 | 7.04 | 0.132 | 273.37 | 188.5
3 | created_at_id | async | 0.28 | 200.8 | 76.4 | 12461.2 [12429.2..12625.5] | 0.321 | 1304 | 7.04 | 0.098 | 352.1 | 187.0
4 | chat_id_created_at_id | sync | 0.42 | 200.8 | 94.0 | 9112.6 [8820.8..9447.6] | 0.439 | 1644 | 7.03 | 0.146 | 275.45 | 187.1
4 | chat_id_created_at_id | async | 0.42 | 200.8 | 94.0 | 12443.6 [12368.3..12483.2] | 0.321 | 1365 | 7.04 | 0.11 | 351.74 | 189.5
5 | none | sync | 0.0 | 200.8 | 37.8 | 9345.7 [9278.8..9600.6] | 0.428 | 1483 | 6.03 | 0.13 | 273.66 | 185.0
5 | none | async | 0.0 | 200.8 | 37.8 | 12550.5 [12436.8..12612.4] | 0.319 | 1216 | 6.06 | 0.097 | 353.1 | 184.5
variant | chat | plan_cache_mode | median ms | plan
chat_id | largest | force_custom_plan | 12.96 | Limit > Gather Merge > Sort > Index Scan(track_chat_idx)
chat_id | largest | force_generic_plan | 28.128 | Limit > Sort > Index Scan(track_chat_idx)
chat_id | smallest | force_custom_plan | 0.029 | Limit > Sort > Index Scan(track_chat_idx)
chat_id | smallest | force_generic_plan | 0.026 | Limit > Sort > Index Scan(track_chat_idx)
created_at_id | largest | force_custom_plan | 0.034 | Limit > Index Scan(track_time_idx)
created_at_id | largest | force_generic_plan | 0.039 | Limit > Index Scan(track_time_idx)
created_at_id | smallest | force_custom_plan | 14.9 | Limit > Gather Merge > Sort > Seq Scan
created_at_id | smallest | force_generic_plan | 156.475 | Limit > Index Scan(track_time_idx)
chat_id_created_at_id | largest | force_custom_plan | 0.023 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | largest | force_generic_plan | 0.022 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | smallest | force_custom_plan | 0.021 | Limit > Index Scan(messages_history_idx)
chat_id_created_at_id | smallest | force_generic_plan | 0.015 | Limit > Index Scan(messages_history_idx)