forked from mtusi2026/mtusi2026lab2
bench: трек 2 — планы запросов, стоимость записи, backup/restore со сверкой
plans.py: 121 120 сообщений (60k/15k/2k/80), 3 индекса x keyset/OFFSET x 3 размера чата, pgbench в отдельном контейнере; WAL на вставку детерминированно. backup_restore.py: pg_dump живой БД во время записи через API, восстановление в новый контейнер и volume, сверка MD5 по чатам, API на восстановленной БД. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a8c6af8c7d
commit
eb92e8e91e
@@ -0,0 +1,155 @@
|
||||
{
|
||||
"image": "postgres:18.6-bookworm@sha256:afc7e2d441324c0388fa80c3d24f733b4194a4eb7f47dd8ee2b08eb1a24a647c",
|
||||
"rounds": [
|
||||
{
|
||||
"round": 1,
|
||||
"backup_started_utc": "2026-10-12T17:06:57+00:00",
|
||||
"dump_seconds": 1.47,
|
||||
"dump_bytes": 5349383,
|
||||
"restore_seconds": 2.21,
|
||||
"analyze_seconds": 0.57,
|
||||
"rto_seconds_restore_plus_analyze": 2.79,
|
||||
"source_counts_after_writer_stopped": {
|
||||
"chat_members": 330,
|
||||
"chats": 290,
|
||||
"messages": 171546,
|
||||
"schema_migrations": 1,
|
||||
"users": 117
|
||||
},
|
||||
"restored_counts": {
|
||||
"chat_members": 330,
|
||||
"chats": 290,
|
||||
"messages": 171410,
|
||||
"schema_migrations": 1,
|
||||
"users": 117
|
||||
},
|
||||
"messages_in_restored": 171410,
|
||||
"per_chat_md5_equal": true,
|
||||
"chats_compared": 257,
|
||||
"big_chat_first_last_50_equal": true,
|
||||
"schema_migrations_equal": true,
|
||||
"indexes_equal": true,
|
||||
"other_table_counts_equal": {
|
||||
"chat_members": true,
|
||||
"chats": true,
|
||||
"schema_migrations": true,
|
||||
"users": true
|
||||
},
|
||||
"writer": {
|
||||
"confirmed": 237,
|
||||
"errors": 0,
|
||||
"in_backup": 101,
|
||||
"restored_is_exact_prefix": true,
|
||||
"lost_confirmed_after_snapshot": 136,
|
||||
"last_message_in_backup_at": "2026-10-12T17:06:57.831240Z",
|
||||
"first_lost_message_at": "2026-10-12T17:06:57.856678Z"
|
||||
},
|
||||
"app_on_restored_db": {
|
||||
"login_ok": true,
|
||||
"history_via_api_equals_restored": true,
|
||||
"messages_read": 101
|
||||
},
|
||||
"reconciled": true
|
||||
},
|
||||
{
|
||||
"round": 2,
|
||||
"backup_started_utc": "2026-10-12T17:07:13+00:00",
|
||||
"dump_seconds": 1.7,
|
||||
"dump_bytes": 5362829,
|
||||
"restore_seconds": 1.9,
|
||||
"analyze_seconds": 0.49,
|
||||
"rto_seconds_restore_plus_analyze": 2.39,
|
||||
"source_counts_after_writer_stopped": {
|
||||
"chat_members": 331,
|
||||
"chats": 291,
|
||||
"messages": 171788,
|
||||
"schema_migrations": 1,
|
||||
"users": 118
|
||||
},
|
||||
"restored_counts": {
|
||||
"chat_members": 331,
|
||||
"chats": 291,
|
||||
"messages": 171655,
|
||||
"schema_migrations": 1,
|
||||
"users": 118
|
||||
},
|
||||
"messages_in_restored": 171655,
|
||||
"per_chat_md5_equal": true,
|
||||
"chats_compared": 258,
|
||||
"big_chat_first_last_50_equal": true,
|
||||
"schema_migrations_equal": true,
|
||||
"indexes_equal": true,
|
||||
"other_table_counts_equal": {
|
||||
"chat_members": true,
|
||||
"chats": true,
|
||||
"schema_migrations": true,
|
||||
"users": true
|
||||
},
|
||||
"writer": {
|
||||
"confirmed": 242,
|
||||
"errors": 0,
|
||||
"in_backup": 109,
|
||||
"restored_is_exact_prefix": true,
|
||||
"lost_confirmed_after_snapshot": 133,
|
||||
"last_message_in_backup_at": "2026-10-12T17:07:14.212768Z",
|
||||
"first_lost_message_at": "2026-10-12T17:07:14.237207Z"
|
||||
},
|
||||
"app_on_restored_db": {
|
||||
"login_ok": true,
|
||||
"history_via_api_equals_restored": true,
|
||||
"messages_read": 109
|
||||
},
|
||||
"reconciled": true
|
||||
},
|
||||
{
|
||||
"round": 3,
|
||||
"backup_started_utc": "2026-10-12T17:07:30+00:00",
|
||||
"dump_seconds": 1.4,
|
||||
"dump_bytes": 5371057,
|
||||
"restore_seconds": 1.76,
|
||||
"analyze_seconds": 0.49,
|
||||
"rto_seconds_restore_plus_analyze": 2.25,
|
||||
"source_counts_after_writer_stopped": {
|
||||
"chat_members": 332,
|
||||
"chats": 292,
|
||||
"messages": 172038,
|
||||
"schema_migrations": 1,
|
||||
"users": 119
|
||||
},
|
||||
"restored_counts": {
|
||||
"chat_members": 332,
|
||||
"chats": 292,
|
||||
"messages": 171898,
|
||||
"schema_migrations": 1,
|
||||
"users": 119
|
||||
},
|
||||
"messages_in_restored": 171898,
|
||||
"per_chat_md5_equal": true,
|
||||
"chats_compared": 259,
|
||||
"big_chat_first_last_50_equal": true,
|
||||
"schema_migrations_equal": true,
|
||||
"indexes_equal": true,
|
||||
"other_table_counts_equal": {
|
||||
"chat_members": true,
|
||||
"chats": true,
|
||||
"schema_migrations": true,
|
||||
"users": true
|
||||
},
|
||||
"writer": {
|
||||
"confirmed": 250,
|
||||
"errors": 0,
|
||||
"in_backup": 110,
|
||||
"restored_is_exact_prefix": true,
|
||||
"lost_confirmed_after_snapshot": 140,
|
||||
"last_message_in_backup_at": "2026-10-12T17:07:31.075846Z",
|
||||
"first_lost_message_at": "2026-10-12T17:07:31.095982Z"
|
||||
},
|
||||
"app_on_restored_db": {
|
||||
"login_ok": true,
|
||||
"history_via_api_equals_restored": true,
|
||||
"messages_read": 110
|
||||
},
|
||||
"reconciled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
Limit (cost=1673.53..1673.58 rows=20 width=238) (actual time=14.400..14.407 rows=51.00 loops=1)
|
||||
Buffers: shared hit=2124 read=53
|
||||
-> Sort (cost=1673.53..1674.03 rows=202 width=238) (actual time=14.398..14.402 rows=51.00 loops=1)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: top-N heapsort Memory: 44kB
|
||||
Buffers: shared hit=2124 read=53
|
||||
-> Bitmap Heap Scan on messages (cost=8.89..1665.79 rows=202 width=238) (actual time=13.229..14.305 rows=300.00 loops=1)
|
||||
Recheck Cond: (chat_id = $1)
|
||||
Filter: (ROW(created_at, id) > ROW($2, $3))
|
||||
Rows Removed by Filter: 59700
|
||||
Heap Blocks: exact=2118
|
||||
Buffers: shared hit=2118 read=53
|
||||
-> Bitmap Index Scan on messages_chat_only (cost=0.00..8.84 rows=606 width=0) (actual time=1.829..1.829 rows=60000.00 loops=1)
|
||||
Index Cond: (chat_id = $1)
|
||||
Index Searches: 1
|
||||
Buffers: shared read=53
|
||||
Planning:
|
||||
Buffers: shared hit=97
|
||||
Planning Time: 0.456 ms
|
||||
Execution Time: 14.511 ms
|
||||
@@ -0,0 +1,20 @@
|
||||
Limit (cost=1673.53..1673.58 rows=20 width=238) (actual time=4.411..4.418 rows=51.00 loops=1)
|
||||
Buffers: shared hit=571 read=14
|
||||
-> Sort (cost=1673.53..1674.03 rows=202 width=238) (actual time=4.410..4.413 rows=51.00 loops=1)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: quicksort Memory: 52kB
|
||||
Buffers: shared hit=571 read=14
|
||||
-> Bitmap Heap Scan on messages (cost=8.89..1665.79 rows=202 width=238) (actual time=4.306..4.361 rows=75.00 loops=1)
|
||||
Recheck Cond: (chat_id = $1)
|
||||
Filter: (ROW(created_at, id) > ROW($2, $3))
|
||||
Rows Removed by Filter: 14925
|
||||
Heap Blocks: exact=564
|
||||
Buffers: shared hit=565 read=14
|
||||
-> Bitmap Index Scan on messages_chat_only (cost=0.00..8.84 rows=606 width=0) (actual time=0.764..0.765 rows=15000.00 loops=1)
|
||||
Index Cond: (chat_id = $1)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=1 read=14
|
||||
Planning:
|
||||
Buffers: shared hit=97
|
||||
Planning Time: 0.339 ms
|
||||
Execution Time: 4.475 ms
|
||||
@@ -0,0 +1,20 @@
|
||||
Limit (cost=1673.53..1673.58 rows=20 width=238) (actual time=0.129..0.130 rows=1.00 loops=1)
|
||||
Buffers: shared hit=11 read=1
|
||||
-> Sort (cost=1673.53..1674.03 rows=202 width=238) (actual time=0.127..0.128 rows=1.00 loops=1)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: quicksort Memory: 25kB
|
||||
Buffers: shared hit=11 read=1
|
||||
-> Bitmap Heap Scan on messages (cost=8.89..1665.79 rows=202 width=238) (actual time=0.104..0.104 rows=1.00 loops=1)
|
||||
Recheck Cond: (chat_id = $1)
|
||||
Filter: (ROW(created_at, id) > ROW($2, $3))
|
||||
Rows Removed by Filter: 79
|
||||
Heap Blocks: exact=4
|
||||
Buffers: shared hit=5 read=1
|
||||
-> Bitmap Index Scan on messages_chat_only (cost=0.00..8.84 rows=606 width=0) (actual time=0.064..0.064 rows=80.00 loops=1)
|
||||
Index Cond: (chat_id = $1)
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=1 read=1
|
||||
Planning:
|
||||
Buffers: shared hit=97
|
||||
Planning Time: 0.368 ms
|
||||
Execution Time: 0.207 ms
|
||||
@@ -0,0 +1,10 @@
|
||||
Limit (cost=0.42..77.92 rows=20 width=237) (actual time=0.456..0.514 rows=51.00 loops=1)
|
||||
Buffers: shared hit=6 read=4
|
||||
-> Index Scan using messages_chat_keyset on messages (cost=0.42..783.20 rows=202 width=237) (actual time=0.451..0.504 rows=51.00 loops=1)
|
||||
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=6 read=4
|
||||
Planning:
|
||||
Buffers: shared hit=120
|
||||
Planning Time: 0.921 ms
|
||||
Execution Time: 0.636 ms
|
||||
@@ -0,0 +1,10 @@
|
||||
Limit (cost=0.42..77.92 rows=20 width=237) (actual time=0.087..0.114 rows=51.00 loops=1)
|
||||
Buffers: shared hit=5 read=2
|
||||
-> Index Scan using messages_chat_keyset on messages (cost=0.42..783.20 rows=202 width=237) (actual time=0.084..0.108 rows=51.00 loops=1)
|
||||
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=5 read=2
|
||||
Planning:
|
||||
Buffers: shared hit=110
|
||||
Planning Time: 0.551 ms
|
||||
Execution Time: 0.156 ms
|
||||
@@ -0,0 +1,10 @@
|
||||
Limit (cost=0.42..77.92 rows=20 width=237) (actual time=0.071..0.072 rows=1.00 loops=1)
|
||||
Buffers: shared hit=2 read=2
|
||||
-> Index Scan using messages_chat_keyset on messages (cost=0.42..783.20 rows=202 width=237) (actual time=0.069..0.070 rows=1.00 loops=1)
|
||||
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Index Searches: 1
|
||||
Buffers: shared hit=2 read=2
|
||||
Planning:
|
||||
Buffers: shared hit=110
|
||||
Planning Time: 0.373 ms
|
||||
Execution Time: 0.112 ms
|
||||
@@ -0,0 +1,20 @@
|
||||
Limit (cost=6162.88..6165.20 rows=20 width=238) (actual time=12.084..15.940 rows=51.00 loops=1)
|
||||
Buffers: shared hit=4307
|
||||
-> Gather Merge (cost=6162.88..6186.40 rows=202 width=238) (actual time=12.082..15.934 rows=51.00 loops=1)
|
||||
Workers Planned: 2
|
||||
Workers Launched: 2
|
||||
Buffers: shared hit=4307
|
||||
-> Sort (cost=5162.85..5163.06 rows=84 width=238) (actual time=8.686..8.690 rows=44.33 loops=3)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: quicksort Memory: 57kB
|
||||
Buffers: shared hit=4307
|
||||
Worker 0: Sort Method: top-N heapsort Memory: 41kB
|
||||
Worker 1: Sort Method: quicksort Memory: 58kB
|
||||
-> Parallel Seq Scan on messages (cost=0.00..5160.17 rows=84 width=238) (actual time=1.775..8.612 rows=100.00 loops=3)
|
||||
Filter: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Rows Removed by Filter: 40273
|
||||
Buffers: shared hit=4277
|
||||
Planning:
|
||||
Buffers: shared hit=89
|
||||
Planning Time: 0.335 ms
|
||||
Execution Time: 16.001 ms
|
||||
@@ -0,0 +1,20 @@
|
||||
Limit (cost=6162.88..6165.20 rows=20 width=238) (actual time=19.403..27.573 rows=51.00 loops=1)
|
||||
Buffers: shared hit=4307
|
||||
-> Gather Merge (cost=6162.88..6186.40 rows=202 width=238) (actual time=19.400..27.552 rows=51.00 loops=1)
|
||||
Workers Planned: 2
|
||||
Workers Launched: 2
|
||||
Buffers: shared hit=4307
|
||||
-> Sort (cost=5162.85..5163.06 rows=84 width=238) (actual time=12.274..12.277 rows=21.00 loops=3)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: quicksort Memory: 44kB
|
||||
Buffers: shared hit=4307
|
||||
Worker 0: Sort Method: quicksort Memory: 27kB
|
||||
Worker 1: Sort Method: quicksort Memory: 30kB
|
||||
-> Parallel Seq Scan on messages (cost=0.00..5160.17 rows=84 width=238) (actual time=5.204..12.212 rows=25.00 loops=3)
|
||||
Filter: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Rows Removed by Filter: 40348
|
||||
Buffers: shared hit=4277
|
||||
Planning:
|
||||
Buffers: shared hit=85
|
||||
Planning Time: 0.565 ms
|
||||
Execution Time: 27.653 ms
|
||||
@@ -0,0 +1,20 @@
|
||||
Limit (cost=6162.88..6165.20 rows=20 width=238) (actual time=12.515..16.342 rows=1.00 loops=1)
|
||||
Buffers: shared hit=4307
|
||||
-> Gather Merge (cost=6162.88..6186.40 rows=202 width=238) (actual time=12.513..16.339 rows=1.00 loops=1)
|
||||
Workers Planned: 2
|
||||
Workers Launched: 2
|
||||
Buffers: shared hit=4307
|
||||
-> Sort (cost=5162.85..5163.06 rows=84 width=238) (actual time=8.455..8.456 rows=0.33 loops=3)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: quicksort Memory: 25kB
|
||||
Buffers: shared hit=4307
|
||||
Worker 0: Sort Method: quicksort Memory: 25kB
|
||||
Worker 1: Sort Method: quicksort Memory: 25kB
|
||||
-> Parallel Seq Scan on messages (cost=0.00..5160.17 rows=84 width=238) (actual time=7.451..8.415 rows=0.33 loops=3)
|
||||
Filter: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
|
||||
Rows Removed by Filter: 40373
|
||||
Buffers: shared hit=4277
|
||||
Planning:
|
||||
Buffers: shared hit=85
|
||||
Planning Time: 0.289 ms
|
||||
Execution Time: 16.395 ms
|
||||
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"image": "postgres:18.6-bookworm@sha256:afc7e2d441324c0388fa80c3d24f733b4194a4eb7f47dd8ee2b08eb1a24a647c",
|
||||
"limits": {
|
||||
"server_cpus": 2,
|
||||
"server_memory": "2g",
|
||||
"pgbench_client_cpus": 2
|
||||
},
|
||||
"pg_settings": "image defaults",
|
||||
"dataset": {
|
||||
"messages_chats_minbytes_maxbytes": "121120|200|10|380",
|
||||
"chat_sizes": [
|
||||
"60000x1",
|
||||
"15000x2",
|
||||
"2000x8",
|
||||
"80x189"
|
||||
],
|
||||
"seed_seconds": 3.3
|
||||
},
|
||||
"pgbench": {
|
||||
"mode": "prepared",
|
||||
"seconds": 10,
|
||||
"warmup": 3,
|
||||
"repeats": 3,
|
||||
"read_clients": 4,
|
||||
"write_clients": 8,
|
||||
"page": "LIMIT 51 after a random position",
|
||||
"write_repeats": 5,
|
||||
"wal_method": "5000 app transactions, 1 client, autovacuum off, CHECKPOINT before; 3 repeats"
|
||||
},
|
||||
"host": {
|
||||
"platform": "Windows-10-10.0.19045-SP0",
|
||||
"docker": "29.8.0"
|
||||
},
|
||||
"variants": {
|
||||
"keyset_index": "(chat_id, created_at, id) — used by the app",
|
||||
"chat_id_index": "(chat_id) only",
|
||||
"no_index": "primary key only",
|
||||
"keyset_plus_sender": "app index + a second index (sender_id, created_at)"
|
||||
},
|
||||
"sizes": {
|
||||
"keyset_index": {
|
||||
"index_build_s": 0.64,
|
||||
"index_bytes": {
|
||||
"messages_chat_keyset": "15097856",
|
||||
"messages_pkey": "10051584"
|
||||
},
|
||||
"table_bytes": 64290816
|
||||
},
|
||||
"chat_id_index": {
|
||||
"index_build_s": 0.25,
|
||||
"index_bytes": {
|
||||
"messages_chat_only": "876544",
|
||||
"messages_pkey": "4775936"
|
||||
},
|
||||
"table_bytes": 35037184
|
||||
},
|
||||
"no_index": {
|
||||
"index_build_s": 0.0,
|
||||
"index_bytes": {
|
||||
"messages_pkey": "4849664"
|
||||
},
|
||||
"table_bytes": 35037184
|
||||
},
|
||||
"keyset_plus_sender": {
|
||||
"index_build_s": 1.67,
|
||||
"index_bytes": {
|
||||
"messages_chat_keyset": "21102592",
|
||||
"messages_pkey": "15286272",
|
||||
"messages_sender_time": "12468224"
|
||||
},
|
||||
"table_bytes": 86335488
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
@@ -0,0 +1,55 @@
|
||||
variant,query,chat,chat_size,repeat,tps,transactions,failed,p50_ms,p95_ms,p99_ms,mean_ms
|
||||
keyset_index,keyset,big,60000,1,2401.7,23998,0,0.873,2.88,32.812,1.651
|
||||
keyset_index,keyset,medium,15000,1,2991.2,29887,0,0.76,1.681,34.535,1.327
|
||||
keyset_index,keyset,small,80,1,4017.5,40162,0,0.576,1.691,11.886,0.986
|
||||
keyset_index,offset,big,60000,1,169.5,1696,0,13.118,70.429,81.03,23.566
|
||||
keyset_index,offset,medium,15000,1,665.7,6672,0,2.909,47.698,53.811,5.995
|
||||
keyset_index,offset,small,80,1,3402.6,34012,0,0.658,1.68,29.655,1.165
|
||||
keyset_index,keyset,big,60000,2,2655.3,26611,0,0.815,2.278,33.597,1.495
|
||||
keyset_index,keyset,medium,15000,2,1887.8,18889,0,0.905,6.01,32.787,2.101
|
||||
keyset_index,keyset,small,80,2,2439.0,24420,0,0.659,5.636,25.202,1.622
|
||||
keyset_index,offset,big,60000,2,180.4,1814,0,11.618,69.186,84.59,22.064
|
||||
keyset_index,offset,medium,15000,2,791.1,7909,0,2.528,43.867,52.614,5.044
|
||||
keyset_index,offset,small,80,2,4059.2,40598,0,0.604,1.05,9.089,0.977
|
||||
keyset_index,keyset,big,60000,3,3486.0,34836,0,0.676,1.191,31.965,1.139
|
||||
keyset_index,keyset,medium,15000,3,3499.1,34950,0,0.675,1.229,31.369,1.134
|
||||
keyset_index,keyset,small,80,3,5575.1,55692,0,0.489,0.791,1.744,0.711
|
||||
keyset_index,offset,big,60000,3,234.7,2357,0,9.301,63.742,68.861,17.016
|
||||
keyset_index,offset,medium,15000,3,852.0,8550,0,2.398,6.87,52.109,4.683
|
||||
keyset_index,offset,small,80,3,4251.9,42587,0,0.584,0.973,3.529,0.933
|
||||
chat_id_index,keyset,big,60000,1,89.8,902,0,27.035,80.852,100.066,44.495
|
||||
chat_id_index,keyset,medium,15000,1,364.0,3653,0,5.595,55.042,58.907,10.973
|
||||
chat_id_index,keyset,small,80,1,4115.2,41258,0,0.6,1.015,4.808,0.964
|
||||
chat_id_index,offset,big,60000,1,28.3,287,0,120.756,277.986,388.776,140.219
|
||||
chat_id_index,offset,medium,15000,1,135.4,1360,0,16.801,71.112,77.884,29.509
|
||||
chat_id_index,offset,small,80,1,4214.0,42116,0,0.587,0.978,4.666,0.941
|
||||
chat_id_index,keyset,big,60000,2,89.4,899,0,28.031,80.795,96.807,44.655
|
||||
chat_id_index,keyset,medium,15000,2,362.5,3623,0,5.642,55.669,59.361,11.022
|
||||
chat_id_index,keyset,small,80,2,4068.0,40695,0,0.603,1.026,5.892,0.975
|
||||
chat_id_index,offset,big,60000,2,28.0,283,0,120.306,292.288,396.718,142.499
|
||||
chat_id_index,offset,medium,15000,2,140.0,1401,0,15.77,71.238,74.833,28.531
|
||||
chat_id_index,offset,small,80,2,4222.1,42290,0,0.579,1.019,3.828,0.939
|
||||
chat_id_index,keyset,big,60000,3,89.5,901,0,27.0,81.494,98.989,44.63
|
||||
chat_id_index,keyset,medium,15000,3,345.7,3473,0,5.885,55.874,59.633,11.54
|
||||
chat_id_index,keyset,small,80,3,4140.1,41444,0,0.59,1.026,4.533,0.958
|
||||
chat_id_index,offset,big,60000,3,29.3,296,0,119.134,208.472,381.353,135.64
|
||||
chat_id_index,offset,medium,15000,3,134.8,1354,0,16.795,71.384,76.114,29.634
|
||||
chat_id_index,offset,small,80,3,4266.0,42637,0,0.581,0.967,3.792,0.93
|
||||
no_index,keyset,big,60000,1,29.0,291,0,111.727,197.369,292.929,137.59
|
||||
no_index,keyset,medium,15000,1,34.3,345,0,104.45,184.828,192.39,116.54
|
||||
no_index,keyset,small,80,1,36.3,364,0,102.442,182.084,192.872,110.02
|
||||
no_index,offset,big,60000,1,25.7,259,0,132.386,293.23,376.222,155.228
|
||||
no_index,offset,medium,15000,1,63.3,635,0,75.84,94.867,109.291,63.124
|
||||
no_index,offset,small,80,1,105.1,1055,0,19.797,72.802,78.183,38.004
|
||||
no_index,keyset,big,60000,2,30.7,309,0,110.372,191.978,200.211,130.118
|
||||
no_index,keyset,medium,15000,2,33.9,340,0,105.192,185.337,190.981,117.813
|
||||
no_index,keyset,small,80,2,37.4,377,0,100.838,180.405,188.141,106.88
|
||||
no_index,offset,big,60000,2,26.4,265,0,134.06,222.582,384.567,151.443
|
||||
no_index,offset,medium,15000,2,49.7,498,0,85.725,118.239,170.86,80.332
|
||||
no_index,offset,small,80,2,84.1,843,0,30.964,82.362,94.9,47.488
|
||||
no_index,keyset,big,60000,3,21.6,219,0,192.061,288.029,303.799,184.125
|
||||
no_index,keyset,medium,15000,3,26.0,263,0,169.475,207.861,283.698,153.341
|
||||
no_index,keyset,small,80,3,25.1,255,0,178.656,220.368,289.13,158.613
|
||||
no_index,offset,big,60000,3,18.0,182,0,205.371,381.47,517.852,221.459
|
||||
no_index,offset,medium,15000,3,44.9,450,0,90.847,150.378,187.415,88.956
|
||||
no_index,offset,small,80,3,77.6,781,0,68.094,86.015,98.542,51.458
|
||||
|
@@ -0,0 +1,34 @@
|
||||
## Чтение: одна страница (LIMIT 51) со случайной позиции чата
|
||||
|
||||
Медиана 3 повторов по 10 с, 4 клиента pgbench, prepared statements. TPS min–max — разброс повторов.
|
||||
|
||||
| Индекс | Запрос | Чат (сообщений) | TPS (min–max) | p50, мс | p95, мс | p99, мс |
|
||||
| --- | --- | ---: | ---: | ---: | ---: | ---: |
|
||||
| keyset_index | keyset | big (60 000) | 2 655 (2 402–3 486) | 0.81 | 2.28 | 32.8 |
|
||||
| keyset_index | keyset | medium (15 000) | 2 991 (1 888–3 499) | 0.76 | 1.68 | 32.8 |
|
||||
| keyset_index | keyset | small (80) | 4 018 (2 439–5 575) | 0.58 | 1.69 | 11.9 |
|
||||
| keyset_index | offset | big (60 000) | 180 (170–235) | 11.6 | 69.2 | 81.0 |
|
||||
| keyset_index | offset | medium (15 000) | 791 (666–852) | 2.53 | 43.9 | 52.6 |
|
||||
| keyset_index | offset | small (80) | 4 059 (3 403–4 252) | 0.60 | 1.05 | 9.09 |
|
||||
| chat_id_index | keyset | big (60 000) | 89.5 (89.4–89.8) | 27.0 | 80.9 | 99.0 |
|
||||
| chat_id_index | keyset | medium (15 000) | 362 (346–364) | 5.64 | 55.7 | 59.4 |
|
||||
| chat_id_index | keyset | small (80) | 4 115 (4 068–4 140) | 0.60 | 1.03 | 4.81 |
|
||||
| chat_id_index | offset | big (60 000) | 28.3 (28.0–29.3) | 120 | 278 | 389 |
|
||||
| chat_id_index | offset | medium (15 000) | 135 (135–140) | 16.8 | 71.2 | 76.1 |
|
||||
| chat_id_index | offset | small (80) | 4 222 (4 214–4 266) | 0.58 | 0.98 | 3.83 |
|
||||
| no_index | keyset | big (60 000) | 29.0 (21.6–30.7) | 112 | 197 | 293 |
|
||||
| no_index | keyset | medium (15 000) | 33.9 (26.0–34.3) | 105 | 185 | 192 |
|
||||
| no_index | keyset | small (80) | 36.3 (25.1–37.4) | 102 | 182 | 193 |
|
||||
| no_index | offset | big (60 000) | 25.7 (18.0–26.4) | 134 | 293 | 385 |
|
||||
| no_index | offset | medium (15 000) | 49.7 (44.9–63.3) | 85.7 | 118 | 171 |
|
||||
| no_index | offset | small (80) | 84.1 (77.6–105) | 31.0 | 82.4 | 94.9 |
|
||||
|
||||
## Запись: транзакция сообщения приложения (UPDATE chats … RETURNING + INSERT)
|
||||
|
||||
TPS и задержка — медиана 5 повторов по 10 с, 8 клиентов. WAL — медиана 3 детерминированных прогонов: 5 000 транзакций, 1 клиент, autovacuum выключен, CHECKPOINT перед прогоном.
|
||||
|
||||
| Индексы messages | TPS (min–max) | p50, мс | p95, мс | p99, мс | WAL, байт/вставку (min–max) | Размер индексов, МиБ |
|
||||
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
|
||||
| no_index | 1 954 (1 540–2 055) | 3.55 | 7.14 | 12.2 | 1930 (1884–1940) | 4.6 |
|
||||
| keyset_index | 1 577 (1 002–1 630) | 4.73 | 8.50 | 13.0 | 2910 (2800–2926) | 24.0 |
|
||||
| keyset_plus_sender | 1 223 (896–1 607) | 6.25 | 9.30 | 13.9 | 3318 (3310–3414) | 46.6 |
|
||||
@@ -0,0 +1,10 @@
|
||||
variant,repeat,inserts,wal_bytes,wal_bytes_per_insert
|
||||
no_index,1,5000,9419936,1884
|
||||
no_index,2,5000,9700304,1940
|
||||
no_index,3,5000,9652184,1930
|
||||
keyset_index,1,5000,14000160,2800
|
||||
keyset_index,2,5000,14548936,2910
|
||||
keyset_index,3,5000,14630336,2926
|
||||
keyset_plus_sender,1,5000,17071344,3414
|
||||
keyset_plus_sender,2,5000,16548592,3310
|
||||
keyset_plus_sender,3,5000,16589232,3318
|
||||
|
@@ -0,0 +1,16 @@
|
||||
variant,repeat,tps,transactions,failed,p50_ms,p95_ms,p99_ms,mean_ms
|
||||
no_index,1,2055.1,20532,0,3.43,6.677,10.312,3.882
|
||||
no_index,2,1953.5,19529,0,3.547,7.139,12.24,4.082
|
||||
no_index,3,2001.8,20012,0,3.487,6.848,10.324,3.983
|
||||
no_index,4,1572.9,15729,0,4.303,9.726,16.331,5.067
|
||||
no_index,5,1539.6,15382,0,4.367,9.093,16.95,5.178
|
||||
keyset_index,1,1002.2,10036,0,5.796,19.448,26.224,7.955
|
||||
keyset_index,2,1222.9,12222,0,6.34,10.159,14.613,6.529
|
||||
keyset_index,3,1629.0,16281,0,4.33,8.497,12.283,4.896
|
||||
keyset_index,4,1629.7,16291,0,4.393,8.13,12.979,4.896
|
||||
keyset_index,5,1577.4,15763,0,4.732,8.336,11.991,5.058
|
||||
keyset_plus_sender,1,937.7,9387,0,6.629,17.527,30.246,8.507
|
||||
keyset_plus_sender,2,895.6,8954,0,6.249,22.727,33.156,8.916
|
||||
keyset_plus_sender,3,1606.9,16067,0,4.58,8.243,11.774,4.965
|
||||
keyset_plus_sender,4,1441.4,14415,0,5.61,8.542,11.815,5.535
|
||||
keyset_plus_sender,5,1223.3,12264,0,6.29,9.296,13.881,6.526
|
||||
|
Reference in New Issue
Block a user