Files
mtusi2026lab2/evidence/query-study.json
T
2026-11-05 01:43:30 +03:00

2247 lines
84 KiB
JSON

{
"messages": 120000,
"warmup": 3,
"measured_reads": 20,
"rounds": 3,
"write_batch": 5000,
"results": [
{
"round": 1,
"variant": "global",
"definition": "CREATE INDEX messages_global ON messages(created_at,id)",
"index_build_ms": 19.939625000006345,
"queries": [
{
"scenario": "hot-middle",
"rows": 51,
"median_ms": 0.11585400000058144,
"p95_ms": 0.14962500000592627,
"raw_ms": [
0.12025000000903674,
0.13220799999658084,
0.15479099999993196,
0.11558299999592236,
0.14962500000592627,
0.12562500000967702,
0.11699999998882049,
0.12375000000020009,
0.12158300000919553,
0.11337500001218359,
0.11708299999213523,
0.11370799998644543,
0.11612500000524051,
0.1064159999941694,
0.10891700000570381,
0.10366600000111248,
0.10516700001517165,
0.10937499999386091,
0.10737499999891043,
0.10837499999638567
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 14.4,
"Plan Rows": 51,
"Plan Width": 394,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.007,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 7,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_global",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 15943.21,
"Plan Rows": 58132,
"Plan Width": 394,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.005,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.05+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))",
"Rows Removed by Index Recheck": 0,
"Filter": "(chat_id = 'f316dbbe-85f1-4587-454d-bfe607cf01de'::uuid)",
"Rows Removed by Filter": 0,
"Shared Hit Blocks": 7,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.007,
"Triggers": [],
"Execution Time": 0.009
}
},
{
"scenario": "medium-first",
"rows": 51,
"median_ms": 5.131312499997875,
"p95_ms": 7.200249999982589,
"raw_ms": [
5.096750000006978,
4.809082999997827,
4.7137499999792,
4.811332999992146,
4.943832999998676,
4.914417000009053,
4.809375000007776,
4.826583999999912,
5.341000000015583,
5.05379099999459,
7.151082999996561,
8.643415999983972,
6.783291000004965,
5.724332999989201,
7.200249999982589,
6.887499999976399,
6.2023749999866595,
5.593625000017255,
5.042666999997891,
5.165874999988773
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 51.9,
"Plan Rows": 51,
"Plan Width": 394,
"Actual Startup Time": 5.437,
"Actual Total Time": 5.441,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 8359,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_global",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 19428.99,
"Plan Rows": 19248,
"Plan Width": 394,
"Actual Startup Time": 5.436,
"Actual Total Time": 5.439,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))",
"Rows Removed by Index Recheck": 0,
"Filter": "(chat_id = '060a8703-6b43-c8ec-2d06-19c37cea7cc6'::uuid)",
"Rows Removed by Filter": 100000,
"Shared Hit Blocks": 8359,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 4,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.017,
"Triggers": [],
"Execution Time": 5.446
}
},
{
"scenario": "tiny-first",
"rows": 10,
"median_ms": 5.662437499992734,
"p95_ms": 6.778332999999748,
"raw_ms": [
3.719832999991013,
3.870124999991731,
3.986207999986391,
4.274541999990333,
3.810874999999214,
3.7367920000122012,
3.876333000022214,
3.7302089999968757,
7.256957999999258,
6.778332999999748,
6.408291999974836,
6.0516249999977845,
5.734916999983852,
5.800957999980483,
5.6901250000009895,
5.695874999986472,
5.738459000014018,
5.628500000000258,
6.0442919999843525,
5.634749999984479
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 8205.06,
"Total Cost": 8206.0,
"Plan Rows": 8,
"Plan Width": 394,
"Actual Startup Time": 2.693,
"Actual Total Time": 3.728,
"Actual Rows": 10,
"Actual Loops": 1,
"Shared Hit Blocks": 6360,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Gather Merge",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 8205.06,
"Total Cost": 8206.0,
"Plan Rows": 8,
"Plan Width": 394,
"Actual Startup Time": 2.693,
"Actual Total Time": 3.727,
"Actual Rows": 10,
"Actual Loops": 1,
"Workers Planned": 2,
"Workers Launched": 2,
"Shared Hit Blocks": 6360,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Sort",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 7205.04,
"Total Cost": 7205.05,
"Plan Rows": 4,
"Plan Width": 394,
"Actual Startup Time": 1.873,
"Actual Total Time": 1.873,
"Actual Rows": 3,
"Actual Loops": 3,
"Sort Key": [
"created_at",
"id"
],
"Sort Method": "quicksort",
"Sort Space Used": 28,
"Sort Space Type": "Memory",
"Shared Hit Blocks": 6360,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Workers": [
{
"Worker Number": 0,
"Sort Method": "quicksort",
"Sort Space Used": 26,
"Sort Space Type": "Memory"
},
{
"Worker Number": 1,
"Sort Method": "quicksort",
"Sort Space Used": 26,
"Sort Space Type": "Memory"
}
],
"Plans": [
{
"Node Type": "Seq Scan",
"Parent Relationship": "Outer",
"Parallel Aware": true,
"Async Capable": false,
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.0,
"Total Cost": 7205.0,
"Plan Rows": 4,
"Plan Width": 394,
"Actual Startup Time": 1.848,
"Actual Total Time": 1.863,
"Actual Rows": 3,
"Actual Loops": 3,
"Filter": "((chat_id = 'b975b2da-d902-87af-0c9a-507e78a7207d'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Filter": 39997,
"Shared Hit Blocks": 6330,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Workers": []
}
]
}
]
}
]
},
"Planning": {
"Shared Hit Blocks": 4,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.03,
"Triggers": [],
"Execution Time": 3.733
}
}
],
"insert_5000_ms": 24.202291999984027,
"index_bytes": 5087232
},
{
"round": 1,
"variant": "chat_first",
"definition": "CREATE INDEX messages_history ON messages(chat_id,created_at,id)",
"index_build_ms": 31.96337500000368,
"queries": [
{
"scenario": "hot-middle",
"rows": 51,
"median_ms": 0.11131199998715147,
"p95_ms": 0.15070799997829454,
"raw_ms": [
0.11629200000129458,
0.12816699998552394,
0.15070799997829454,
0.10850000001028093,
0.10866599998848869,
0.12441699999499178,
0.1790000000028158,
0.13920800000732925,
0.11570799998139591,
0.10987499999259853,
0.10962499999322972,
0.1082089999897562,
0.10720899999228095,
0.10720899999228095,
0.11337499998376188,
0.1019169999949554,
0.10995799999591327,
0.12283299997761787,
0.11266599997838966,
0.10795800000096278
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 24.95,
"Plan Rows": 51,
"Plan Width": 395,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.007,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 8,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 28100.77,
"Plan Rows": 58407,
"Plan Width": 395,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.005,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "((chat_id = 'f316dbbe-85f1-4587-454d-bfe607cf01de'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.05+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 8,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.008,
"Triggers": [],
"Execution Time": 0.01
}
},
{
"scenario": "medium-first",
"rows": 51,
"median_ms": 0.11112499998944259,
"p95_ms": 0.11591699998803051,
"raw_ms": [
0.11216699999749835,
0.1079999999831216,
0.10612500000206637,
0.11512500000776527,
0.11324999999828833,
0.11124999997491614,
0.11179200001265599,
0.11037500001975786,
0.12250000000335604,
0.11591699998803051,
0.11258300000349664,
0.11166699999876073,
0.11100000000396903,
0.11099999997554733,
0.10654199999748926,
0.10879199999180855,
0.11066600001186089,
0.11366699999371122,
0.10970799999654446,
0.10616699998422519
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 69.57,
"Plan Rows": 51,
"Plan Width": 395,
"Actual Startup Time": 0.003,
"Actual Total Time": 0.007,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 6,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 26161.2,
"Plan Rows": 19294,
"Plan Width": 395,
"Actual Startup Time": 0.003,
"Actual Total Time": 0.005,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "((chat_id = '060a8703-6b43-c8ec-2d06-19c37cea7cc6'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 6,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.007,
"Triggers": [],
"Execution Time": 0.009
}
},
{
"scenario": "tiny-first",
"rows": 10,
"median_ms": 0.06262549999291878,
"p95_ms": 0.0644590000149492,
"raw_ms": [
0.06662499998810745,
0.0637920000201575,
0.06337499999631291,
0.06279099997641424,
0.06287499999757529,
0.062374999998837666,
0.0644590000149492,
0.06254100000546714,
0.06295900001873633,
0.06266699998036529,
0.06258299998762595,
0.06229199999552293,
0.06258400000547226,
0.062374999998837666,
0.062499999984311216,
0.06233299998825714,
0.062374999998837666,
0.06279199999426055,
0.06337499999631291,
0.06179199999678531
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 47.54,
"Total Cost": 47.57,
"Plan Rows": 11,
"Plan Width": 395,
"Actual Startup Time": 0.004,
"Actual Total Time": 0.005,
"Actual Rows": 10,
"Actual Loops": 1,
"Shared Hit Blocks": 13,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Sort",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 47.54,
"Total Cost": 47.57,
"Plan Rows": 11,
"Plan Width": 395,
"Actual Startup Time": 0.004,
"Actual Total Time": 0.004,
"Actual Rows": 10,
"Actual Loops": 1,
"Sort Key": [
"created_at",
"id"
],
"Sort Method": "quicksort",
"Sort Space Used": 31,
"Sort Space Type": "Memory",
"Shared Hit Blocks": 13,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Bitmap Heap Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 4.53,
"Total Cost": 47.35,
"Plan Rows": 11,
"Plan Width": 395,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.003,
"Actual Rows": 10,
"Actual Loops": 1,
"Recheck Cond": "((chat_id = 'b975b2da-d902-87af-0c9a-507e78a7207d'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Exact Heap Blocks": 10,
"Lossy Heap Blocks": 0,
"Shared Hit Blocks": 13,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Bitmap Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Index Name": "messages_history",
"Startup Cost": 0.0,
"Total Cost": 4.53,
"Plan Rows": 11,
"Plan Width": 0,
"Actual Startup Time": 0.001,
"Actual Total Time": 0.001,
"Actual Rows": 10,
"Actual Loops": 1,
"Index Cond": "((chat_id = 'b975b2da-d902-87af-0c9a-507e78a7207d'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Shared Hit Blocks": 3,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
}
]
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.007,
"Triggers": [],
"Execution Time": 0.007
}
}
],
"insert_5000_ms": 24.6168339999997,
"index_bytes": 7618560
},
{
"round": 2,
"variant": "chat_first",
"definition": "CREATE INDEX messages_history ON messages(chat_id,created_at,id)",
"index_build_ms": 27.856374999998934,
"queries": [
{
"scenario": "hot-middle",
"rows": 51,
"median_ms": 0.11539549998929033,
"p95_ms": 0.1479169999925034,
"raw_ms": [
0.11529099998597303,
0.13433399999485118,
0.16337499999963256,
0.12470800001551652,
0.11320799998770781,
0.10891600001627921,
0.10920900001565315,
0.11704100000997641,
0.10887499999512329,
0.11445799998455186,
0.1479169999925034,
0.1341249999882166,
0.12620800001172938,
0.1145000000235541,
0.12300000000209366,
0.11120899998218192,
0.11391600000365543,
0.11549999999260763,
0.12912500000084037,
0.1104590000124972
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 24.91,
"Plan Rows": 51,
"Plan Width": 395,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.008,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 8,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 28053.33,
"Plan Rows": 58410,
"Plan Width": 395,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.006,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "((chat_id = 'f316dbbe-85f1-4587-454d-bfe607cf01de'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.05+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 8,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.01,
"Triggers": [],
"Execution Time": 0.011
}
},
{
"scenario": "medium-first",
"rows": 51,
"median_ms": 0.1114794999921287,
"p95_ms": 0.12112500002103843,
"raw_ms": [
0.11266699999623597,
0.11349999999765714,
0.11750000001597982,
0.11179199998423428,
0.1116249999881802,
0.11133399999607718,
0.11100000000396903,
0.11116700000002311,
0.1102499999774409,
0.11087499999007377,
0.11545800001044881,
0.12112500002103843,
0.12162499999135434,
0.11112499998944259,
0.11008299998138682,
0.11029199998802142,
0.11108299997886206,
0.11870800000224335,
0.11904099997650519,
0.11020899998470668
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 70.47,
"Plan Rows": 51,
"Plan Width": 395,
"Actual Startup Time": 0.003,
"Actual Total Time": 0.007,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 6,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 26095.12,
"Plan Rows": 18998,
"Plan Width": 395,
"Actual Startup Time": 0.003,
"Actual Total Time": 0.005,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "((chat_id = '060a8703-6b43-c8ec-2d06-19c37cea7cc6'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 6,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.007,
"Triggers": [],
"Execution Time": 0.009
}
},
{
"scenario": "tiny-first",
"rows": 10,
"median_ms": 0.062374999998837666,
"p95_ms": 0.07570900001496739,
"raw_ms": [
0.06962500000895488,
0.06500000000642103,
0.06366600001683764,
0.062374999998837666,
0.061875000000100044,
0.06229200002394464,
0.06316700000752462,
0.06179100000736071,
0.06599999997547457,
0.062374999998837666,
0.07024999999316606,
0.1158750000058717,
0.07570900001496739,
0.06250000001273293,
0.06029200000057244,
0.06012500000451837,
0.05954200000246601,
0.059583999984624825,
0.0595409999846197,
0.05924999999251668
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 44.03,
"Plan Rows": 10,
"Plan Width": 395,
"Actual Startup Time": 0.001,
"Actual Total Time": 0.003,
"Actual Rows": 10,
"Actual Loops": 1,
"Shared Hit Blocks": 13,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 44.03,
"Plan Rows": 10,
"Plan Width": 395,
"Actual Startup Time": 0.001,
"Actual Total Time": 0.002,
"Actual Rows": 10,
"Actual Loops": 1,
"Index Cond": "((chat_id = 'b975b2da-d902-87af-0c9a-507e78a7207d'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 13,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.007,
"Triggers": [],
"Execution Time": 0.004
}
}
],
"insert_5000_ms": 24.579541000008476,
"index_bytes": 7618560
},
{
"round": 2,
"variant": "global",
"definition": "CREATE INDEX messages_global ON messages(created_at,id)",
"index_build_ms": 20.559500000018716,
"queries": [
{
"scenario": "hot-middle",
"rows": 51,
"median_ms": 0.11108349998778522,
"p95_ms": 0.15091699998492913,
"raw_ms": [
0.1314579999984744,
0.12300000000209366,
0.15091699998492913,
0.11058299998012444,
0.11158399999544599,
0.10995899998533787,
0.11016700000254787,
0.129624999999578,
0.11966700000698438,
0.108667000006335,
0.1077500000121745,
0.1091249999944921,
0.10879100000238395,
0.10904200001959907,
0.10725000001343687,
0.1082080000003316,
0.12204200001519894,
0.15733300000420058,
0.12799999998946987,
0.12120799999593146
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 14.43,
"Plan Rows": 51,
"Plan Width": 395,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.007,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 7,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_global",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 16107.42,
"Plan Rows": 58611,
"Plan Width": 395,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.005,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.05+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))",
"Rows Removed by Index Recheck": 0,
"Filter": "(chat_id = 'f316dbbe-85f1-4587-454d-bfe607cf01de'::uuid)",
"Rows Removed by Filter": 0,
"Shared Hit Blocks": 7,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.009,
"Triggers": [],
"Execution Time": 0.01
}
},
{
"scenario": "medium-first",
"rows": 51,
"median_ms": 4.756061999998451,
"p95_ms": 5.617499999999609,
"raw_ms": [
4.789166000023215,
4.751083000002154,
4.761040999994748,
5.268583999992416,
4.699332999990702,
4.651417000019364,
4.644708999990144,
4.701791999991656,
4.811291000009987,
4.796833000000333,
4.749291000024414,
4.844958000006727,
5.035416999987774,
4.6884170000112135,
4.729958000012857,
4.680250000006936,
4.630167000016172,
5.617499999999609,
5.76812500000301,
5.280708000015011
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 52.74,
"Plan Rows": 51,
"Plan Width": 395,
"Actual Startup Time": 5.041,
"Actual Total Time": 5.047,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 8359,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_global",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 19568.03,
"Plan Rows": 19072,
"Plan Width": 395,
"Actual Startup Time": 5.041,
"Actual Total Time": 5.045,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))",
"Rows Removed by Index Recheck": 0,
"Filter": "(chat_id = '060a8703-6b43-c8ec-2d06-19c37cea7cc6'::uuid)",
"Rows Removed by Filter": 100000,
"Shared Hit Blocks": 8359,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 4,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.018,
"Triggers": [],
"Execution Time": 5.051
}
},
{
"scenario": "tiny-first",
"rows": 10,
"median_ms": 5.718500000000404,
"p95_ms": 6.6727089999858435,
"raw_ms": [
4.06704200000263,
4.093957999998565,
4.138374999996586,
4.055666999988716,
4.021166999990555,
4.03537500000084,
4.136291000008896,
4.063333999994256,
7.17987500001982,
6.6727089999858435,
6.107124999999769,
5.8875000000000455,
5.727124999992839,
5.748791000002029,
6.00845800002503,
5.770959000017228,
5.632166999987476,
5.709875000007969,
5.902958000007175,
6.06904200000713
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 8265.08,
"Total Cost": 8266.25,
"Plan Rows": 10,
"Plan Width": 395,
"Actual Startup Time": 3.049,
"Actual Total Time": 4.111,
"Actual Rows": 10,
"Actual Loops": 1,
"Shared Hit Blocks": 6420,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Gather Merge",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 8265.08,
"Total Cost": 8266.25,
"Plan Rows": 10,
"Plan Width": 395,
"Actual Startup Time": 3.049,
"Actual Total Time": 4.11,
"Actual Rows": 10,
"Actual Loops": 1,
"Workers Planned": 2,
"Workers Launched": 2,
"Shared Hit Blocks": 6420,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Sort",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 7265.06,
"Total Cost": 7265.07,
"Plan Rows": 5,
"Plan Width": 395,
"Actual Startup Time": 2.21,
"Actual Total Time": 2.21,
"Actual Rows": 3,
"Actual Loops": 3,
"Sort Key": [
"created_at",
"id"
],
"Sort Method": "quicksort",
"Sort Space Used": 28,
"Sort Space Type": "Memory",
"Shared Hit Blocks": 6420,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Workers": [
{
"Worker Number": 0,
"Sort Method": "quicksort",
"Sort Space Used": 27,
"Sort Space Type": "Memory"
},
{
"Worker Number": 1,
"Sort Method": "quicksort",
"Sort Space Used": 25,
"Sort Space Type": "Memory"
}
],
"Plans": [
{
"Node Type": "Seq Scan",
"Parent Relationship": "Outer",
"Parallel Aware": true,
"Async Capable": false,
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.0,
"Total Cost": 7265.0,
"Plan Rows": 5,
"Plan Width": 395,
"Actual Startup Time": 2.182,
"Actual Total Time": 2.198,
"Actual Rows": 3,
"Actual Loops": 3,
"Filter": "((chat_id = 'b975b2da-d902-87af-0c9a-507e78a7207d'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Filter": 39997,
"Shared Hit Blocks": 6390,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Workers": []
}
]
}
]
}
]
},
"Planning": {
"Shared Hit Blocks": 4,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.028,
"Triggers": [],
"Execution Time": 4.116
}
}
],
"insert_5000_ms": 23.839417000004914,
"index_bytes": 5087232
},
{
"round": 3,
"variant": "global",
"definition": "CREATE INDEX messages_global ON messages(created_at,id)",
"index_build_ms": 15.723166999976002,
"queries": [
{
"scenario": "hot-middle",
"rows": 51,
"median_ms": 0.11222950000444598,
"p95_ms": 0.1303330000155256,
"raw_ms": [
0.12162499999135434,
0.1303330000155256,
0.15454200001840945,
0.11466699999118646,
0.11262500001407716,
0.11166699999876073,
0.1271659999986241,
0.11920800000098097,
0.11229200001139361,
0.11216699999749835,
0.11012500002038905,
0.11020799999528208,
0.11733300001992575,
0.10975000000712498,
0.11016700000254787,
0.11645800000792406,
0.10937500002228262,
0.10970799999654446,
0.10950000000775617,
0.10925000000838736
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 14.46,
"Plan Rows": 51,
"Plan Width": 395,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.007,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 7,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_global",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 16065.23,
"Plan Rows": 58354,
"Plan Width": 395,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.005,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.05+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))",
"Rows Removed by Index Recheck": 0,
"Filter": "(chat_id = 'f316dbbe-85f1-4587-454d-bfe607cf01de'::uuid)",
"Rows Removed by Filter": 0,
"Shared Hit Blocks": 7,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.007,
"Triggers": [],
"Execution Time": 0.009
}
},
{
"scenario": "medium-first",
"rows": 51,
"median_ms": 4.721770999992714,
"p95_ms": 5.025249999988546,
"raw_ms": [
4.993624999997337,
4.892083000015646,
4.74429199999804,
4.717249999998785,
4.715833999995311,
4.652040999985729,
4.726291999986643,
4.6801249999930405,
4.771041999987347,
4.676249999988613,
4.951374999990321,
5.075583999996525,
4.868125000001555,
4.701250000010759,
4.6724579999875,
5.025249999988546,
4.641665999997713,
4.856999999987011,
4.64454199999409,
4.631125000003067
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 54.1,
"Plan Rows": 51,
"Plan Width": 395,
"Actual Startup Time": 5.321,
"Actual Total Time": 5.326,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 8359,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_global",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 19567.81,
"Plan Rows": 18588,
"Plan Width": 395,
"Actual Startup Time": 5.321,
"Actual Total Time": 5.323,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid))",
"Rows Removed by Index Recheck": 0,
"Filter": "(chat_id = '060a8703-6b43-c8ec-2d06-19c37cea7cc6'::uuid)",
"Rows Removed by Filter": 100000,
"Shared Hit Blocks": 8359,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 4,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.012,
"Triggers": [],
"Execution Time": 5.329
}
},
{
"scenario": "tiny-first",
"rows": 10,
"median_ms": 5.748104500000295,
"p95_ms": 6.240958000006458,
"raw_ms": [
3.8787500000125874,
4.155792000005931,
3.8188329999968573,
3.958209000018087,
3.8624999999967713,
4.073792000014009,
4.160167000009096,
4.176916999995228,
6.89495899999315,
6.0927500000218515,
6.240958000006458,
5.886250000003201,
5.834915999997747,
5.734042000000272,
5.803541999995332,
5.783083000011402,
5.7749170000249705,
5.75937499999668,
5.8940410000047905,
5.73683400000391
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 8265.08,
"Total Cost": 8266.25,
"Plan Rows": 10,
"Plan Width": 395,
"Actual Startup Time": 2.905,
"Actual Total Time": 3.932,
"Actual Rows": 10,
"Actual Loops": 1,
"Shared Hit Blocks": 6420,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Gather Merge",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 8265.08,
"Total Cost": 8266.25,
"Plan Rows": 10,
"Plan Width": 395,
"Actual Startup Time": 2.904,
"Actual Total Time": 3.931,
"Actual Rows": 10,
"Actual Loops": 1,
"Workers Planned": 2,
"Workers Launched": 2,
"Shared Hit Blocks": 6420,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Sort",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 7265.06,
"Total Cost": 7265.07,
"Plan Rows": 5,
"Plan Width": 395,
"Actual Startup Time": 2.048,
"Actual Total Time": 2.048,
"Actual Rows": 3,
"Actual Loops": 3,
"Sort Key": [
"created_at",
"id"
],
"Sort Method": "quicksort",
"Sort Space Used": 28,
"Sort Space Type": "Memory",
"Shared Hit Blocks": 6420,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Workers": [
{
"Worker Number": 0,
"Sort Method": "quicksort",
"Sort Space Used": 26,
"Sort Space Type": "Memory"
},
{
"Worker Number": 1,
"Sort Method": "quicksort",
"Sort Space Used": 26,
"Sort Space Type": "Memory"
}
],
"Plans": [
{
"Node Type": "Seq Scan",
"Parent Relationship": "Outer",
"Parallel Aware": true,
"Async Capable": false,
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.0,
"Total Cost": 7265.0,
"Plan Rows": 5,
"Plan Width": 395,
"Actual Startup Time": 2.015,
"Actual Total Time": 2.038,
"Actual Rows": 3,
"Actual Loops": 3,
"Filter": "((chat_id = 'b975b2da-d902-87af-0c9a-507e78a7207d'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Filter": 39997,
"Shared Hit Blocks": 6390,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Workers": []
}
]
}
]
}
]
},
"Planning": {
"Shared Hit Blocks": 4,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.03,
"Triggers": [],
"Execution Time": 3.938
}
}
],
"insert_5000_ms": 23.95654200000763,
"index_bytes": 5087232
},
{
"round": 3,
"variant": "chat_first",
"definition": "CREATE INDEX messages_history ON messages(chat_id,created_at,id)",
"index_build_ms": 31.026790999987952,
"queries": [
{
"scenario": "hot-middle",
"rows": 51,
"median_ms": 0.11708350001526924,
"p95_ms": 0.16016600000057224,
"raw_ms": [
0.14262499999517786,
0.17820900001197515,
0.16016600000057224,
0.11416699999244884,
0.11895899999103676,
0.11800000001471744,
0.11708300002055694,
0.12433300000225245,
0.11620800000855525,
0.11016599998470156,
0.11604200000192577,
0.11725000001661101,
0.11629200000129458,
0.11845800000287454,
0.10962499999322972,
0.12208300000793315,
0.11708400000998154,
0.10916700000507262,
0.10875000000964974,
0.11020799999528208
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 24.89,
"Plan Rows": 51,
"Plan Width": 394,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.007,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 8,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 28071.93,
"Plan Rows": 58503,
"Plan Width": 394,
"Actual Startup Time": 0.002,
"Actual Total Time": 0.005,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "((chat_id = 'f316dbbe-85f1-4587-454d-bfe607cf01de'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.05+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 8,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.008,
"Triggers": [],
"Execution Time": 0.01
}
},
{
"scenario": "medium-first",
"rows": 51,
"median_ms": 0.1172499999881893,
"p95_ms": 0.1262499999938882,
"raw_ms": [
0.11233299997570612,
0.11354200000823766,
0.11179099999480968,
0.11870899999166795,
0.11912499999766624,
0.1172499999881893,
0.12212499999009196,
0.1262499999938882,
0.11879199999498269,
0.11766699998361219,
0.1107079999940197,
0.10758299998769871,
0.119958999988512,
0.11883300001613861,
0.11233300000412783,
0.13425000000211185,
0.1172499999881893,
0.11100000000396903,
0.11104200001454956,
0.11050000000523141
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 70.3,
"Plan Rows": 51,
"Plan Width": 394,
"Actual Startup Time": 0.003,
"Actual Total Time": 0.007,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 6,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 26110.13,
"Plan Rows": 19054,
"Plan Width": 394,
"Actual Startup Time": 0.003,
"Actual Total Time": 0.005,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "((chat_id = '060a8703-6b43-c8ec-2d06-19c37cea7cc6'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 6,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.009,
"Triggers": [],
"Execution Time": 0.009
}
},
{
"scenario": "tiny-first",
"rows": 10,
"median_ms": 0.06033350000222981,
"p95_ms": 0.06625000000326509,
"raw_ms": [
0.06291600001873121,
0.06625000000326509,
0.06020800000783311,
0.06587499999000102,
0.0705839999852742,
0.06029200000057244,
0.060416999986045994,
0.060040999983357324,
0.06004200000120363,
0.060415999996621395,
0.06083400000989059,
0.05991699998730837,
0.059332999995831415,
0.059708000009095485,
0.06191700001068057,
0.05991700001573008,
0.05962500000578075,
0.06241599999157188,
0.05895800001098905,
0.06037500000388718
],
"explain": {
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.42,
"Total Cost": 48.01,
"Plan Rows": 11,
"Plan Width": 394,
"Actual Startup Time": 0.001,
"Actual Total Time": 0.003,
"Actual Rows": 10,
"Actual Loops": 1,
"Shared Hit Blocks": 13,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.42,
"Total Cost": 48.01,
"Plan Rows": 11,
"Plan Width": 394,
"Actual Startup Time": 0.001,
"Actual Total Time": 0.002,
"Actual Rows": 10,
"Actual Loops": 1,
"Index Cond": "((chat_id = 'b975b2da-d902-87af-0c9a-507e78a7207d'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 13,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.007,
"Triggers": [],
"Execution Time": 0.004
}
}
],
"insert_5000_ms": 24.8786250000137,
"index_bytes": 7618560
}
],
"query": "SELECT * FROM messages WHERE chat_id=%s AND (created_at,id)>(%s,%s) ORDER BY created_at,id LIMIT 51",
"backup_restore": {
"backup_s": 0.3191805409999997,
"fresh_container_bootstrap_and_restore_s": 1.7497035829999996,
"verification_s": 0.9298119170000003,
"dump_bytes": 4100901,
"expected": {
"counts": {
"users": 1,
"chats": 102,
"members": 102,
"messages": 120000,
"sessions": 0,
"schema_migrations": 1
},
"messages_sha256": "fcc7a69c6f3fe35cabe5eab0645a7ace6774fca5a120541a4ccb92edbb58d9b8",
"samples": [
{
"id": "1967c72e-0f99-6e94-49df-d95443a6e048",
"chat_id": "b975b2da-d902-87af-0c9a-507e78a7207d",
"sender_id": "55898af9-a840-7b34-688e-1debc76c4318",
"text": "synthetic-120000-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2026-01-01 00:00:00.120000+00:00"
},
{
"id": "3d6b824f-d8c1-520e-9a04-7d21fee6fb1f",
"chat_id": "f316dbbe-85f1-4587-454d-bfe607cf01de",
"sender_id": "55898af9-a840-7b34-688e-1debc76c4318",
"text": "synthetic-1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2026-01-01 00:00:00.000001+00:00"
},
{
"id": "c7ce0cb5-7145-84f8-1353-48e6f6de9210",
"chat_id": "f316dbbe-85f1-4587-454d-bfe607cf01de",
"sender_id": "55898af9-a840-7b34-688e-1debc76c4318",
"text": "synthetic-100000-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2026-01-01 00:00:00.100000+00:00"
}
]
},
"restored": {
"counts": {
"users": 1,
"chats": 102,
"members": 102,
"messages": 120000,
"sessions": 0,
"schema_migrations": 1
},
"messages_sha256": "fcc7a69c6f3fe35cabe5eab0645a7ace6774fca5a120541a4ccb92edbb58d9b8",
"samples": [
{
"id": "1967c72e-0f99-6e94-49df-d95443a6e048",
"chat_id": "b975b2da-d902-87af-0c9a-507e78a7207d",
"sender_id": "55898af9-a840-7b34-688e-1debc76c4318",
"text": "synthetic-120000-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2026-01-01 00:00:00.120000+00:00"
},
{
"id": "3d6b824f-d8c1-520e-9a04-7d21fee6fb1f",
"chat_id": "f316dbbe-85f1-4587-454d-bfe607cf01de",
"sender_id": "55898af9-a840-7b34-688e-1debc76c4318",
"text": "synthetic-1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2026-01-01 00:00:00.000001+00:00"
},
{
"id": "c7ce0cb5-7145-84f8-1353-48e6f6de9210",
"chat_id": "f316dbbe-85f1-4587-454d-bfe607cf01de",
"sender_id": "55898af9-a840-7b34-688e-1debc76c4318",
"text": "synthetic-100000-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2026-01-01 00:00:00.100000+00:00"
}
]
},
"identical": true,
"source_database": "lab2_study_73b956d721",
"restored_database": "lab2_study_73b956d721_restored",
"new_volume": "lab2-recovery-73b956d721-data",
"recovery_container": "lab2-recovery-73b956d721",
"limitation": "logical snapshot; no PITR or concurrent writes; separate PostgreSQL instance and fresh named volume on the same physical Docker host"
},
"utc": "2026-11-04T22:40:12.276392+00:00"
}