{ "verified_at": "2026-10-05T17:43:13.860337+00:00", "track": 2, "hypothesis": "(chat_id, created_at, id) should reduce ordered keyset reads in a large chat compared to (chat_id), at a larger index size and possible insertion cost", "distribution": [ 80000, 15000, 4000, 1000 ], "fixture_messages": 100000, "method": { "write_runs": "1 warm-up + 3 measured; alternate variant order; same PK/FK and 100000 rows", "read_runs": "1 warm-up + 5 measured per scenario; median PostgreSQL Execution Time", "timing_scope": "SQL INSERT includes index and FK work; excludes commit/HTTP latency; warm buffers, one local Docker host" }, "environment": { "server_version": "17.6 (Debian 17.6-2.pgdg13+1)", "shared_buffers": "128MB", "work_mem": "4MB", "fsync": "on", "synchronous_commit": "on" }, "indexes": { "chat_only": { "index": "(chat_id)", "write_samples_ms": [ 2140.54, 3095.419, 1585.882 ], "read_plans": { "large_first": { "query": "SELECT id, chat_id, sender_id, text, created_at FROM research_5cb838a51069419ea30e72a890ff8c46.chat_only WHERE chat_id = 'a3395291-519b-495d-8476-82aeca15e567'::uuid ORDER BY created_at, id LIMIT 51", "samples_ms": [ 15.97, 16.155, 17.929, 12.598, 15.531 ], "median_ms": 15.97, "explain_analyze_buffers": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 5501.7, "Total Cost": 5507.56, "Plan Rows": 51, "Plan Width": 148, "Actual Startup Time": 14.463, "Actual Total Time": 15.915, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2254, "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": 5501.7, "Total Cost": 10935.56, "Plan Rows": 47251, "Plan Width": 148, "Actual Startup Time": 14.461, "Actual Total Time": 15.906, "Actual Rows": 51, "Actual Loops": 1, "Workers Planned": 1, "Workers Launched": 1, "Shared Hit Blocks": 2254, "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": 4501.69, "Total Cost": 4619.82, "Plan Rows": 47251, "Plan Width": 148, "Actual Startup Time": 12.728, "Actual Total Time": 12.733, "Actual Rows": 51, "Actual Loops": 2, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 37, "Sort Space Type": "Memory", "Shared Hit Blocks": 2254, "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": "top-N heapsort", "Sort Space Used": 36, "Sort Space Type": "Memory" } ], "Plans": [ { "Node Type": "Seq Scan", "Parent Relationship": "Outer", "Parallel Aware": true, "Async Capable": false, "Relation Name": "chat_only", "Alias": "chat_only", "Startup Cost": 0.0, "Total Cost": 2925.29, "Plan Rows": 47251, "Plan Width": 148, "Actual Startup Time": 0.013, "Actual Total Time": 8.014, "Actual Rows": 40000, "Actual Loops": 2, "Filter": "(chat_id = 'a3395291-519b-495d-8476-82aeca15e567'::uuid)", "Rows Removed by Filter": 10000, "Shared Hit Blocks": 2190, "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": 96, "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.252, "Triggers": [], "Execution Time": 15.97 } }, "large_after_75000": { "query": "SELECT id, chat_id, sender_id, text, created_at FROM research_5cb838a51069419ea30e72a890ff8c46.chat_only WHERE chat_id = 'a3395291-519b-495d-8476-82aeca15e567'::uuid AND (created_at, id) > ('2026-01-01T00:00:00Z'::timestamptz + 75000 * interval '1 millisecond', '541dce4919c624fbbe86851695269f35'::uuid) ORDER BY created_at, id LIMIT 51", "samples_ms": [ 8.601, 8.604, 8.794, 9.397, 9.376 ], "median_ms": 8.794, "explain_analyze_buffers": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4331.22, "Total Cost": 4331.35, "Plan Rows": 51, "Plan Width": 148, "Actual Startup Time": 8.755, "Actual Total Time": 8.764, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2196, "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": 4331.22, "Total Cost": 4341.8, "Plan Rows": 4233, "Plan Width": 148, "Actual Startup Time": 8.754, "Actual Total Time": 8.758, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 37, "Sort Space Type": "Memory", "Shared Hit Blocks": 2196, "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": "Seq Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Relation Name": "chat_only", "Alias": "chat_only", "Startup Cost": 0.0, "Total Cost": 4190.0, "Plan Rows": 4233, "Plan Width": 148, "Actual Startup Time": 7.633, "Actual Total Time": 8.246, "Actual Rows": 5000, "Actual Loops": 1, "Filter": "((chat_id = 'a3395291-519b-495d-8476-82aeca15e567'::uuid) AND (ROW(created_at, id) > ROW(('2026-01-01 00:00:00+00'::timestamp with time zone + '00:01:15'::interval), '541dce49-19c6-24fb-be86-851695269f35'::uuid)))", "Rows Removed by Filter": 95000, "Shared Hit Blocks": 2190, "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": 95, "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.248, "Triggers": [], "Execution Time": 8.794 } }, "small_after_500": { "query": "SELECT id, chat_id, sender_id, text, created_at FROM research_5cb838a51069419ea30e72a890ff8c46.chat_only WHERE chat_id = 'e67907a5-dd19-430d-ba73-4db1416029de'::uuid AND (created_at, id) > ('2026-01-01T00:00:00Z'::timestamptz + 500 * interval '1 millisecond', '098f3f837b23b6d7a3eaecdb449c89ae'::uuid) ORDER BY created_at, id LIMIT 51", "samples_ms": [ 0.429, 0.46, 0.42, 0.392, 0.392 ], "median_ms": 0.42, "explain_analyze_buffers": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 600.75, "Total Cost": 600.88, "Plan Rows": 51, "Plan Width": 148, "Actual Startup Time": 0.387, "Actual Total Time": 0.396, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 96, "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": 600.75, "Total Cost": 603.22, "Plan Rows": 989, "Plan Width": 148, "Actual Startup Time": 0.386, "Actual Total Time": 0.39, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 37, "Sort Space Type": "Memory", "Shared Hit Blocks": 96, "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": "chat_only_history_idx", "Relation Name": "chat_only", "Alias": "chat_only", "Startup Cost": 0.29, "Total Cost": 567.75, "Plan Rows": 989, "Plan Width": 148, "Actual Startup Time": 0.093, "Actual Total Time": 0.3, "Actual Rows": 500, "Actual Loops": 1, "Index Cond": "(chat_id = 'e67907a5-dd19-430d-ba73-4db1416029de'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "(ROW(created_at, id) > ROW(('2026-01-01 00:00:00+00'::timestamp with time zone + '00:00:00.5'::interval), '098f3f83-7b23-b6d7-a3ea-ecdb449c89ae'::uuid))", "Rows Removed by Filter": 500, "Shared Hit Blocks": 90, "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": 95, "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.208, "Triggers": [], "Execution Time": 0.42 } } }, "last_write_plan": { "Plan": { "Node Type": "ModifyTable", "Operation": "Insert", "Parallel Aware": false, "Async Capable": false, "Relation Name": "chat_only", "Alias": "chat_only", "Startup Cost": 888.47, "Total Cost": 889.09, "Plan Rows": 0, "Plan Width": 0, "Actual Startup Time": 535.577, "Actual Total Time": 535.578, "Actual Rows": 0, "Actual Loops": 1, "Shared Hit Blocks": 553520, "Shared Read Blocks": 2, "Shared Dirtied Blocks": 2822, "Shared Written Blocks": 2822, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 1950, "Temp Written Blocks": 1954, "Plans": [ { "Node Type": "Sort", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 888.47, "Total Cost": 889.09, "Plan Rows": 248, "Plan Width": 151, "Actual Startup Time": 86.41, "Actual Total Time": 106.532, "Actual Rows": 100000, "Actual Loops": 1, "Sort Key": [ "messages.created_at", "messages.id" ], "Sort Method": "external merge", "Sort Space Used": 15600, "Sort Space Type": "Disk", "Shared Hit Blocks": 3548, "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": 1950, "Temp Written Blocks": 1954, "Plans": [ { "Node Type": "Bitmap Heap Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Relation Name": "messages", "Alias": "messages", "Startup Cost": 19.61, "Total Cost": 878.61, "Plan Rows": 248, "Plan Width": 151, "Actual Startup Time": 23.032, "Actual Total Time": 43.859, "Actual Rows": 100000, "Actual Loops": 1, "Recheck Cond": "(chat_id = ANY ('{a3395291-519b-495d-8476-82aeca15e567,8a792b01-20f6-4e0d-b375-f98ff5f055f7,91ba724d-6147-4fbf-8184-7b4a320b666b,e67907a5-dd19-430d-ba73-4db1416029de}'::uuid[]))", "Rows Removed by Index Recheck": 0, "Exact Heap Blocks": 2259, "Lossy Heap Blocks": 0, "Shared Hit Blocks": 3542, "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_chat_created_id_idx", "Startup Cost": 0.0, "Total Cost": 19.55, "Plan Rows": 248, "Plan Width": 0, "Actual Startup Time": 22.775, "Actual Total Time": 22.775, "Actual Rows": 100000, "Actual Loops": 1, "Index Cond": "(chat_id = ANY ('{a3395291-519b-495d-8476-82aeca15e567,8a792b01-20f6-4e0d-b375-f98ff5f055f7,91ba724d-6147-4fbf-8184-7b4a320b666b,e67907a5-dd19-430d-ba73-4db1416029de}'::uuid[]))", "Shared Hit Blocks": 1283, "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": 107, "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.781, "Triggers": [ { "Trigger Name": "RI_ConstraintTrigger_c_16647", "Constraint Name": "chat_only_chat_id_fkey", "Relation": "chat_only", "Time": 650.23, "Calls": 100000 }, { "Trigger Name": "RI_ConstraintTrigger_c_16652", "Constraint Name": "chat_only_sender_id_fkey", "Relation": "chat_only", "Time": 385.892, "Calls": 100000 } ], "Execution Time": 1585.882 }, "write_median_ms": 2140.54, "history_index_bytes": 671744, "table_and_indexes_bytes": 23142400 }, "keyset": { "index": "(chat_id, created_at, id)", "write_samples_ms": [ 1687.041, 2016.552, 2646.463 ], "read_plans": { "large_first": { "query": "SELECT id, chat_id, sender_id, text, created_at FROM research_5cb838a51069419ea30e72a890ff8c46.keyset WHERE chat_id = 'a3395291-519b-495d-8476-82aeca15e567'::uuid ORDER BY created_at, id LIMIT 51", "samples_ms": [ 0.068, 0.072, 0.077, 0.069, 0.081 ], "median_ms": 0.072, "explain_analyze_buffers": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.42, "Total Cost": 7.38, "Plan Rows": 51, "Plan Width": 148, "Actual Startup Time": 0.022, "Actual Total Time": 0.05, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 9, "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": "keyset_history_idx", "Relation Name": "keyset", "Alias": "keyset", "Startup Cost": 0.42, "Total Cost": 10940.51, "Plan Rows": 80103, "Plan Width": 148, "Actual Startup Time": 0.021, "Actual Total Time": 0.044, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'a3395291-519b-495d-8476-82aeca15e567'::uuid)", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 9, "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": 107, "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.225, "Triggers": [], "Execution Time": 0.072 } }, "large_after_75000": { "query": "SELECT id, chat_id, sender_id, text, created_at FROM research_5cb838a51069419ea30e72a890ff8c46.keyset WHERE chat_id = 'a3395291-519b-495d-8476-82aeca15e567'::uuid AND (created_at, id) > ('2026-01-01T00:00:00Z'::timestamptz + 75000 * interval '1 millisecond', '541dce4919c624fbbe86851695269f35'::uuid) ORDER BY created_at, id LIMIT 51", "samples_ms": [ 0.079, 0.08, 0.064, 0.066, 0.063 ], "median_ms": 0.066, "explain_analyze_buffers": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.42, "Total Cost": 60.59, "Plan Rows": 51, "Plan Width": 148, "Actual Startup Time": 0.026, "Actual Total Time": 0.038, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 5, "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": "keyset_history_idx", "Relation Name": "keyset", "Alias": "keyset", "Startup Cost": 0.42, "Total Cost": 4691.1, "Plan Rows": 3976, "Plan Width": 148, "Actual Startup Time": 0.025, "Actual Total Time": 0.032, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "((chat_id = 'a3395291-519b-495d-8476-82aeca15e567'::uuid) AND (ROW(created_at, id) > ROW(('2026-01-01 00:00:00+00'::timestamp with time zone + '00:01:15'::interval), '541dce49-19c6-24fb-be86-851695269f35'::uuid)))", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 5, "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": 106, "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.226, "Triggers": [], "Execution Time": 0.066 } }, "small_after_500": { "query": "SELECT id, chat_id, sender_id, text, created_at FROM research_5cb838a51069419ea30e72a890ff8c46.keyset WHERE chat_id = 'e67907a5-dd19-430d-ba73-4db1416029de'::uuid AND (created_at, id) > ('2026-01-01T00:00:00Z'::timestamptz + 500 * interval '1 millisecond', '098f3f837b23b6d7a3eaecdb449c89ae'::uuid) ORDER BY created_at, id LIMIT 51", "samples_ms": [ 0.075, 0.092, 0.083, 0.084, 0.073 ], "median_ms": 0.083, "explain_analyze_buffers": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.42, "Total Cost": 92.83, "Plan Rows": 51, "Plan Width": 148, "Actual Startup Time": 0.026, "Actual Total Time": 0.048, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 9, "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": "keyset_history_idx", "Relation Name": "keyset", "Alias": "keyset", "Startup Cost": 0.42, "Total Cost": 1680.12, "Plan Rows": 927, "Plan Width": 148, "Actual Startup Time": 0.025, "Actual Total Time": 0.042, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "((chat_id = 'e67907a5-dd19-430d-ba73-4db1416029de'::uuid) AND (ROW(created_at, id) > ROW(('2026-01-01 00:00:00+00'::timestamp with time zone + '00:00:00.5'::interval), '098f3f83-7b23-b6d7-a3ea-ecdb449c89ae'::uuid)))", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 9, "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": 106, "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.215, "Triggers": [], "Execution Time": 0.083 } } }, "last_write_plan": { "Plan": { "Node Type": "ModifyTable", "Operation": "Insert", "Parallel Aware": false, "Async Capable": false, "Relation Name": "keyset", "Alias": "keyset", "Startup Cost": 888.47, "Total Cost": 889.09, "Plan Rows": 0, "Plan Width": 0, "Actual Startup Time": 848.458, "Actual Total Time": 848.462, "Actual Rows": 0, "Actual Loops": 1, "Shared Hit Blocks": 638805, "Shared Read Blocks": 2, "Shared Dirtied Blocks": 4025, "Shared Written Blocks": 4025, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 1950, "Temp Written Blocks": 1954, "Plans": [ { "Node Type": "Sort", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 888.47, "Total Cost": 889.09, "Plan Rows": 248, "Plan Width": 151, "Actual Startup Time": 98.082, "Actual Total Time": 120.759, "Actual Rows": 100000, "Actual Loops": 1, "Sort Key": [ "messages.created_at", "messages.id" ], "Sort Method": "external merge", "Sort Space Used": 15600, "Sort Space Type": "Disk", "Shared Hit Blocks": 3548, "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": 1950, "Temp Written Blocks": 1954, "Plans": [ { "Node Type": "Bitmap Heap Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Relation Name": "messages", "Alias": "messages", "Startup Cost": 19.61, "Total Cost": 878.61, "Plan Rows": 248, "Plan Width": 151, "Actual Startup Time": 21.717, "Actual Total Time": 46.307, "Actual Rows": 100000, "Actual Loops": 1, "Recheck Cond": "(chat_id = ANY ('{a3395291-519b-495d-8476-82aeca15e567,8a792b01-20f6-4e0d-b375-f98ff5f055f7,91ba724d-6147-4fbf-8184-7b4a320b666b,e67907a5-dd19-430d-ba73-4db1416029de}'::uuid[]))", "Rows Removed by Index Recheck": 0, "Exact Heap Blocks": 2259, "Lossy Heap Blocks": 0, "Shared Hit Blocks": 3542, "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_chat_created_id_idx", "Startup Cost": 0.0, "Total Cost": 19.55, "Plan Rows": 248, "Plan Width": 0, "Actual Startup Time": 21.349, "Actual Total Time": 21.352, "Actual Rows": 100000, "Actual Loops": 1, "Index Cond": "(chat_id = ANY ('{a3395291-519b-495d-8476-82aeca15e567,8a792b01-20f6-4e0d-b375-f98ff5f055f7,91ba724d-6147-4fbf-8184-7b4a320b666b,e67907a5-dd19-430d-ba73-4db1416029de}'::uuid[]))", "Shared Hit Blocks": 1283, "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": 107, "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.409, "Triggers": [ { "Trigger Name": "RI_ConstraintTrigger_c_16665", "Constraint Name": "keyset_chat_id_fkey", "Relation": "keyset", "Time": 1041.042, "Calls": 100000 }, { "Trigger Name": "RI_ConstraintTrigger_c_16670", "Constraint Name": "keyset_sender_id_fkey", "Relation": "keyset", "Time": 731.602, "Calls": 100000 } ], "Execution Time": 2646.463 }, "write_median_ms": 2016.552, "history_index_bytes": 10526720, "table_and_indexes_bytes": 32997376 } }, "recovery": { "backup_started_at": "2026-10-05T17:43:01.864344+00:00", "backup_finished_at": "2026-10-05T17:43:03.355967+00:00", "backup_seconds": 1.4912840830074856, "backup_bytes": 12239941, "backup_file": "backups/lab2-9141f49f4eb947bf.dump", "bootstrap_seconds": 0.7361297080060467, "pg_restore_seconds": 2.164719166001305, "verification_seconds": 3.7413219580048462, "source_volume": "mtusi2026lab2_postgres_data", "restored_volume": "mtusi2026lab2_restore_data", "restored_database": "restored_9141f49f4eb947bf", "target_initial_public_table_count": 0, "manifest": { "table_counts": { "users": 191, "chats": 73, "chat_members": 125, "messages": 380569, "sessions": 183, "schema_migrations": 1 }, "fixture_digest_md5": "7f31b71a7f144ef51b8cebfafd4b80df", "selected_messages": [ { "id": "60277674-f120-e85c-1207-1e9614951a73", "chat_id": "a3395291-519b-495d-8476-82aeca15e567", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 80000 message message message message message message message message message message message message ", "created_at": "2026-01-01T00:01:20+00:00" }, { "id": "776f8d05-5dcb-3684-bc4e-d827a5520a6a", "chat_id": "a3395291-519b-495d-8476-82aeca15e567", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 1 message message message message message ", "created_at": "2026-01-01T00:00:00.001+00:00" }, { "id": "78d70635-cdd0-838b-c623-f7de47e6a42f", "chat_id": "a3395291-519b-495d-8476-82aeca15e567", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 40000 message message message message message message message message ", "created_at": "2026-01-01T00:00:40+00:00" }, { "id": "01118572-0cc2-8b97-9832-e41f0c6d5689", "chat_id": "8a792b01-20f6-4e0d-b375-f98ff5f055f7", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 7500 message message message message ", "created_at": "2026-01-01T00:00:07.5+00:00" }, { "id": "d266070e-b83a-19e2-a4de-16dbf0085c27", "chat_id": "8a792b01-20f6-4e0d-b375-f98ff5f055f7", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 1 message message message message message ", "created_at": "2026-01-01T00:00:00.001+00:00" }, { "id": "f723f71e-91be-982c-21c8-e53f36e3eae5", "chat_id": "8a792b01-20f6-4e0d-b375-f98ff5f055f7", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 15000 message message message message ", "created_at": "2026-01-01T00:00:15+00:00" }, { "id": "33466037-1a39-8c5f-8f93-dd57fed9c8f5", "chat_id": "91ba724d-6147-4fbf-8184-7b4a320b666b", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 2000 message message message message message message message message message message message message ", "created_at": "2026-01-01T00:00:02+00:00" }, { "id": "9826e660-bbdf-3208-98d0-861f0799ecdc", "chat_id": "91ba724d-6147-4fbf-8184-7b4a320b666b", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 4000 message message message message message message message message ", "created_at": "2026-01-01T00:00:04+00:00" }, { "id": "cc6a7ab9-af17-6898-fc4a-78c5b8163817", "chat_id": "91ba724d-6147-4fbf-8184-7b4a320b666b", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 1 message message message message message ", "created_at": "2026-01-01T00:00:00.001+00:00" }, { "id": "098f3f83-7b23-b6d7-a3ea-ecdb449c89ae", "chat_id": "e67907a5-dd19-430d-ba73-4db1416029de", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 500 message message message message message message message message message message message message ", "created_at": "2026-01-01T00:00:00.5+00:00" }, { "id": "b006db2d-1c9c-b35b-78d0-e0c6ce9d190b", "chat_id": "e67907a5-dd19-430d-ba73-4db1416029de", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 1 message message message message message ", "created_at": "2026-01-01T00:00:00.001+00:00" }, { "id": "b6ea4ab4-7822-fc16-fcfe-ecf9b0d67894", "chat_id": "e67907a5-dd19-430d-ba73-4db1416029de", "sender_id": "f055f039-80b4-488c-90bf-24a73ebfe65c", "text": "research 1000 message message message message message message message message ", "created_at": "2026-01-01T00:00:01+00:00" } ] }, "restored_manifest_matches": true, "post_backup_marker": { "id": "6e5ad2c3-e930-4aaf-a651-c9a972dac9a3", "created_at": "2026-10-05T17:43:06.3845640Z", "present_in_source": true, "present_in_restore": false }, "snapshot_constraint": "no concurrent application writes during manifest/dump comparison; pg_dump provides its own consistent snapshot", "loss_boundary": "restore includes dump snapshot only; later confirmed writes require a newer backup or WAL/PITR" } }