# Track 2 results Generated by experiments/track2/run.py from results.json. Environment: OrbStack, 11 CPU, 9434726400 B RAM; PostgreSQL 17.6, shared_buffers 128MB, synchronous_commit on. Dataset: 239717 messages, 300 synthetic chats, sizes max 60000 / median 146 / min 64, top-10 chats hold 0.618 of track2 messages, table 73785344 B. ## Read: median ms of 5 EXPLAIN ANALYZE runs / shared buffers / rows read by scans | query / chat | V0 PK only | V1 (chat_id) | V2 (chat_id, created_at) | V3 (chat_id, created_at, id) | |---|---|---|---|---| | first page (API) / large | 25.56 / 9030 / 239718 | 35.60 / 9055 / 60000 | 0.14 / 25 / 52 | 0.22 / 15 / 51 | | first page (API) / medium | 25.16 / 9030 / 239718 | 4.35 / 965 / 1013 | 0.34 / 63 / 52 | 0.42 / 53 / 51 | | first page (API) / small | 29.76 / 9030 / 239715 | 0.55 / 72 / 64 | 0.39 / 63 / 52 | 0.54 / 53 / 51 | | middle page keyset (API) / large | 25.17 / 9030 / 239718 | 24.59 / 9055 / 60000 | 0.19 / 21 / 53 | 0.26 / 11 / 51 | | middle page keyset (API) / medium | 23.41 / 9030 / 239718 | 3.60 / 965 / 1013 | 0.60 / 66 / 53 | 0.45 / 55 / 51 | | middle page keyset (API) / small | 21.25 / 9030 / 239715 | 0.64 / 72 / 64 | 0.37 / 44 / 32 | 0.49 / 35 / 31 | | middle page keyset + created_at >= / large | 28.13 / 9030 / 239718 | 35.80 / 9031 / 60000 | 0.34 / 21 / 53 | 0.12 / 11 / 51 | | middle page keyset + created_at >= / medium | 26.97 / 9030 / 239718 | 3.13 / 965 / 1013 | 0.49 / 66 / 53 | 0.23 / 55 / 51 | | middle page keyset + created_at >= / small | 24.64 / 9030 / 239715 | 0.44 / 72 / 64 | 0.42 / 41 / 32 | 0.35 / 41 / 31 | | middle page OFFSET / large | 81.35 / 9088 / 239718 | 42.15 / 9055 / 60000 | 80.17 / 9088 / 239718 | 15.32 / 6145 / 30051 | | middle page OFFSET / medium | 25.94 / 9088 / 239718 | 3.01 / 965 / 1013 | 2.53 / 554 / 558 | 1.88 / 545 / 557 | | middle page OFFSET / small | 32.84 / 9088 / 239715 | 0.40 / 72 / 64 | 0.74 / 75 / 64 | 0.38 / 67 / 64 | Plans of the API query (middle page, large chat): - V0 PK only: `Limit > Gather Merge > Sort > Seq Scan` - V1 (chat_id): `Limit > Gather Merge > Sort > Bitmap Heap Scan > Bitmap Index Scan exp_idx` - V2 (chat_id, created_at): `Limit > Incremental Sort > Index Scan exp_idx` - V3 (chat_id, created_at, id): `Limit > Index Scan messages_chat_created_id_idx` ## Write cost | variant | index size, MiB | build, s | bulk 50k INSERT, ms (median of 3) | pgbench 1-row INSERT, TPS (median of 3x10 s, 8 clients) | avg latency, ms | |---|---|---|---|---|---| | V0 PK only | 0.0 | 0.00 | 2158 | 2237 | 3.576 | | V1 (chat_id) | 1.7 | 0.30 | 1174 | 1820 | 4.395 | | V2 (chat_id, created_at) | 9.3 | 0.34 | 1748 | 1338 | 5.979 | | V3 (chat_id, created_at, id) | 13.5 | 0.48 | 1062 | 1659 | 4.822 | ## Backup -> restore into new storage -> reconcile - pg_dump -Fc: 3.37 s, 16135498 B; pg_restore into a new container + new volume: {'jobs_1': 3.76, 'jobs_4': 4.01} - fingerprints (count + md5 of every table, 20 sampled messages) equal: True; API page of the large chat equal: True - writes committed during pg_dump: 13 in source, 1 in restore - restored plan of the API query: `Limit > Index Scan messages_chat_created_id_idx` | table | rows | md5 | |---|---|---| | users | 1019 | 42d7e548b2d4ee91736961faca386d0a | | chats | 306 | d2541ecae4fa59a1f1192498d0f5b4e0 | | chat_members | 3295 | 4f1cf6a7c65e7a56c072c20877d7d28f | | messages | 239717 | 1c0251c775eecc3ffc43c28b81084eea | | schema_migrations | 1 | 550e0a1f7ef8568bdbe21b29ffb5399b |