From 171b6de9c87c14cdfb1f9ec6a58aab7101c23d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=81=D0=BB=D0=BE=D0=B2?= Date: Sat, 7 Nov 2026 08:14:59 +0300 Subject: [PATCH] test: record query plans and add bounded pool verification --- evidence/query-plan.json | 9801 ++++++++++++++++++++++++++++++++++++++ pyproject.toml | 5 + research/analyze.py | 134 + scripts/verify_pool.py | 116 + 4 files changed, 10056 insertions(+) create mode 100644 evidence/query-plan.json create mode 100644 research/analyze.py create mode 100644 scripts/verify_pool.py diff --git a/evidence/query-plan.json b/evidence/query-plan.json new file mode 100644 index 0000000..a8b5503 --- /dev/null +++ b/evidence/query-plan.json @@ -0,0 +1,9801 @@ +{ + "date": "2026-11-07T05:12:22.527542+00:00", + "commit": "d978b8ff4d32f5d5d8f230bf1b48047e8a6490a4", + "command": "python -m research.query_plan", + "db_cpu_limit": 1, + "db_memory_limit_bytes": 536870912, + "prepared_statements": "disabled for comparable custom EXPLAIN plans", + "dataset": { + "chat_sizes": [ + 90000, + 10000, + 1000, + 100, + 10 + ], + "messages": 101110, + "text_characters": 80, + "source": "synthetic SQL seed; no production API or working tables modified" + }, + "reads": [ + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 90000, + "position": "head", + "execution_ms": 9.887, + "planning_ms": 0.054, + "shared_hits": 2167, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 5961.44, + "Total Cost": 5967.25, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 8.694, + "Actual Total Time": 9.874, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 2167, + "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": 5961.44, + "Total Cost": 16232.47, + "Plan Rows": 90120, + "Plan Width": 137, + "Actual Startup Time": 8.693, + "Actual Total Time": 9.869, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Workers Planned": 1, + "Workers Launched": 1, + "Shared Hit Blocks": 2167, + "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": 4961.43, + "Total Cost": 5093.96, + "Plan Rows": 53012, + "Plan Width": 137, + "Actual Startup Time": 7.598, + "Actual Total Time": 7.6, + "Actual Rows": 51.0, + "Actual Loops": 2, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2167, + "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": 38, + "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": 3192.84, + "Plan Rows": 53012, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 3.876, + "Actual Rows": 44999.5, + "Actual Loops": 2, + "Disabled": false, + "Filter": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '196dd32d-4f4c-12ae-63a4-94dd5d673c8f'::uuid)))", + "Rows Removed by Filter": 5556, + "Shared Hit Blocks": 2152, + "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": 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.054, + "Triggers": [], + "Execution Time": 9.887 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 90000, + "position": "middle", + "execution_ms": 7.237, + "planning_ms": 0.056, + "shared_hits": 2167, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4978.23, + "Total Cost": 4984.04, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 6.122, + "Actual Total Time": 7.224, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 2167, + "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": 4978.23, + "Total Cost": 9539.33, + "Plan Rows": 40020, + "Plan Width": 137, + "Actual Startup Time": 6.121, + "Actual Total Time": 7.22, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Workers Planned": 1, + "Workers Launched": 1, + "Shared Hit Blocks": 2167, + "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": 3978.22, + "Total Cost": 4037.07, + "Plan Rows": 23541, + "Plan Width": 137, + "Actual Startup Time": 4.986, + "Actual Total Time": 4.989, + "Actual Rows": 38.5, + "Actual Loops": 2, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2167, + "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": 38, + "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": 3192.84, + "Plan Rows": 23541, + "Plan Width": 137, + "Actual Startup Time": 1.094, + "Actual Total Time": 3.119, + "Actual Rows": 22499.5, + "Actual Loops": 2, + "Disabled": false, + "Filter": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.045001+00'::timestamp with time zone, '9608c03d-0a64-d881-4c17-5d0b327cb7e5'::uuid)))", + "Rows Removed by Filter": 28056, + "Shared Hit Blocks": 2152, + "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": 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.056, + "Triggers": [], + "Execution Time": 7.237 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 90000, + "position": "tail", + "execution_ms": 4.287, + "planning_ms": 0.05, + "shared_hits": 2152, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.63, + "Total Cost": 3922.74, + "Plan Rows": 44, + "Plan Width": 137, + "Actual Startup Time": 4.27, + "Actual Total Time": 4.276, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 2152, + "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": 3922.63, + "Total Cost": 3922.74, + "Plan Rows": 44, + "Plan Width": 137, + "Actual Startup Time": 4.269, + "Actual Total Time": 4.272, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2152, + "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": "messages", + "Alias": "messages", + "Startup Cost": 0.0, + "Total Cost": 3921.43, + "Plan Rows": 44, + "Plan Width": 137, + "Actual Startup Time": 3.84, + "Actual Total Time": 4.257, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Filter": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.089949+00'::timestamp with time zone, '62d50dce-8b88-97a6-c3ca-f675e48ee09a'::uuid)))", + "Rows Removed by Filter": 101059, + "Shared Hit Blocks": 2152, + "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.05, + "Triggers": [], + "Execution Time": 4.287 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 10000, + "position": "head", + "execution_ms": 1.845, + "planning_ms": 0.021, + "shared_hits": 224, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 803.66, + "Total Cost": 803.79, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 1.832, + "Actual Total Time": 1.838, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 224, + "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": 803.66, + "Total Cost": 828.36, + "Plan Rows": 9881, + "Plan Width": 137, + "Actual Startup Time": 1.832, + "Actual Total Time": 1.834, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 224, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 474.01, + "Plan Rows": 9881, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.999, + "Actual Rows": 9999.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8f771595-16b0-a07f-31c3-79d136b2a3de'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "Shared Hit Blocks": 224, + "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.021, + "Triggers": [], + "Execution Time": 1.845 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 10000, + "position": "middle", + "execution_ms": 1.187, + "planning_ms": 0.019, + "shared_hits": 224, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 767.56, + "Total Cost": 767.69, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 1.175, + "Actual Total Time": 1.18, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 224, + "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": 767.56, + "Total Cost": 789.56, + "Plan Rows": 8799, + "Plan Width": 137, + "Actual Startup Time": 1.174, + "Actual Total Time": 1.177, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 224, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 474.01, + "Plan Rows": 8799, + "Plan Width": 137, + "Actual Startup Time": 0.29, + "Actual Total Time": 0.758, + "Actual Rows": 4999.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, '427c7fd3-6ea6-ffd4-bbd2-c6cdbb452719'::uuid))", + "Rows Removed by Filter": 5001, + "Index Searches": 1, + "Shared Hit Blocks": 224, + "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.019, + "Triggers": [], + "Execution Time": 1.187 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 10000, + "position": "tail", + "execution_ms": 0.878, + "planning_ms": 0.024, + "shared_hits": 224, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 736.94, + "Total Cost": 737.06, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.864, + "Actual Total Time": 0.87, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 224, + "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": 736.94, + "Total Cost": 756.64, + "Plan Rows": 7881, + "Plan Width": 137, + "Actual Startup Time": 0.864, + "Actual Total Time": 0.866, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 224, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 474.01, + "Plan Rows": 7881, + "Plan Width": 137, + "Actual Startup Time": 0.852, + "Actual Total Time": 0.858, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.009949+00'::timestamp with time zone, 'cd49e803-f71e-7ccb-ff7d-6b76a2a2e3d5'::uuid))", + "Rows Removed by Filter": 9949, + "Index Searches": 1, + "Shared Hit Blocks": 224, + "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.024, + "Triggers": [], + "Execution Time": 0.878 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 1000, + "position": "head", + "execution_ms": 0.205, + "planning_ms": 0.017, + "shared_hits": 25, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 83.61, + "Total Cost": 83.74, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.193, + "Actual Total Time": 0.2, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 25, + "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": 83.61, + "Total Cost": 86.06, + "Plan Rows": 981, + "Plan Width": 137, + "Actual Startup Time": 0.193, + "Actual Total Time": 0.196, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 25, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 50.88, + "Plan Rows": 981, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.103, + "Actual Rows": 999.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '3765865a-ec55-3c2c-d202-d12cfedbcf7f'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "Shared Hit Blocks": 25, + "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.017, + "Triggers": [], + "Execution Time": 0.205 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 1000, + "position": "middle", + "execution_ms": 0.152, + "planning_ms": 0.023, + "shared_hits": 25, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 83.08, + "Total Cost": 83.2, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.14, + "Actual Total Time": 0.146, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 25, + "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": 83.08, + "Total Cost": 85.49, + "Plan Rows": 965, + "Plan Width": 137, + "Actual Startup Time": 0.139, + "Actual Total Time": 0.142, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 25, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 50.88, + "Plan Rows": 965, + "Plan Width": 137, + "Actual Startup Time": 0.039, + "Actual Total Time": 0.09, + "Actual Rows": 499.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000501+00'::timestamp with time zone, '1db93204-3f0e-f6f7-aa5d-178875465c75'::uuid))", + "Rows Removed by Filter": 501, + "Index Searches": 1, + "Shared Hit Blocks": 25, + "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.023, + "Triggers": [], + "Execution Time": 0.152 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 1000, + "position": "tail", + "execution_ms": 0.106, + "planning_ms": 0.018, + "shared_hits": 25, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 82.64, + "Total Cost": 82.77, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.076, + "Actual Total Time": 0.1, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 25, + "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": 82.64, + "Total Cost": 85.02, + "Plan Rows": 952, + "Plan Width": 137, + "Actual Startup Time": 0.076, + "Actual Total Time": 0.079, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 25, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 50.88, + "Plan Rows": 952, + "Plan Width": 137, + "Actual Startup Time": 0.065, + "Actual Total Time": 0.07, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000949+00'::timestamp with time zone, 'ee935a50-b6a6-429a-822c-7fbf4fabff8c'::uuid))", + "Rows Removed by Filter": 949, + "Index Searches": 1, + "Shared Hit Blocks": 25, + "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.018, + "Triggers": [], + "Execution Time": 0.106 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 100, + "position": "head", + "execution_ms": 0.039, + "planning_ms": 0.024, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 16.39, + "Total Cost": 16.52, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.026, + "Actual Total Time": 0.032, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 16.39, + "Total Cost": 16.66, + "Plan Rows": 108, + "Plan Width": 137, + "Actual Startup Time": 0.026, + "Actual Total Time": 0.029, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 50, + "Sort Space Type": "Memory", + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 12.79, + "Plan Rows": 108, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.014, + "Actual Rows": 99.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8feb17b9-f3ba-823e-1bb2-6673b12b41c8'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 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 + } + ] + } + ] + }, + "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.024, + "Triggers": [], + "Execution Time": 0.039 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 100, + "position": "middle", + "execution_ms": 0.03, + "planning_ms": 0.021, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 16.39, + "Total Cost": 16.52, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.018, + "Actual Total Time": 0.025, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "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": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 16.39, + "Total Cost": 16.66, + "Plan Rows": 108, + "Plan Width": 137, + "Actual Startup Time": 0.018, + "Actual Total Time": 0.021, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 37, + "Sort Space Type": "Memory", + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 12.79, + "Plan Rows": 108, + "Plan Width": 137, + "Actual Startup Time": 0.007, + "Actual Total Time": 0.012, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000051+00'::timestamp with time zone, 'f89d4cb7-e52a-3f1e-e7c0-631a83fb8713'::uuid))", + "Rows Removed by Filter": 51, + "Index Searches": 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 + } + ] + } + ] + }, + "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.021, + "Triggers": [], + "Execution Time": 0.03 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 100, + "position": "tail", + "execution_ms": 0.031, + "planning_ms": 0.022, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 16.39, + "Total Cost": 16.52, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.019, + "Actual Total Time": 0.025, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 16.39, + "Total Cost": 16.66, + "Plan Rows": 108, + "Plan Width": 137, + "Actual Startup Time": 0.018, + "Actual Total Time": 0.021, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 12.79, + "Plan Rows": 108, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000049+00'::timestamp with time zone, '94ed74f8-577f-2142-e435-3ec857c9c0d4'::uuid))", + "Rows Removed by Filter": 49, + "Index Searches": 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 + } + ] + } + ] + }, + "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.022, + "Triggers": [], + "Execution Time": 0.031 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 10, + "position": "head", + "execution_ms": 0.011, + "planning_ms": 0.019, + "shared_hits": 3, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.69, + "Total Cost": 8.71, + "Plan Rows": 10, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.007, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.69, + "Total Cost": 8.71, + "Plan Rows": 10, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.006, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 27, + "Sort Space Type": "Memory", + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 8.52, + "Plan Rows": 10, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.004, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "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.019, + "Triggers": [], + "Execution Time": 0.011 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 10, + "position": "middle", + "execution_ms": 0.01, + "planning_ms": 0.019, + "shared_hits": 3, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.69, + "Total Cost": 8.71, + "Plan Rows": 10, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.006, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.69, + "Total Cost": 8.71, + "Plan Rows": 10, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.005, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 26, + "Sort Space Type": "Memory", + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 8.52, + "Plan Rows": 10, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.004, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000006+00'::timestamp with time zone, '07db7782-4351-7046-33b5-30864a334828'::uuid))", + "Rows Removed by Filter": 6, + "Index Searches": 1, + "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.019, + "Triggers": [], + "Execution Time": 0.01 + } + }, + { + "repeat": 1, + "variant": "chat_only", + "chat_messages": 10, + "position": "tail", + "execution_ms": 0.011, + "planning_ms": 0.018, + "shared_hits": 3, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.69, + "Total Cost": 8.71, + "Plan Rows": 10, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.007, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.69, + "Total Cost": 8.71, + "Plan Rows": 10, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.006, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 27, + "Sort Space Type": "Memory", + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 8.52, + "Plan Rows": 10, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.004, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "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.018, + "Triggers": [], + "Execution Time": 0.011 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 90000, + "position": "head", + "execution_ms": 0.02, + "planning_ms": 0.027, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 5.69, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.013, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 9282.7, + "Plan Rows": 89780, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.009, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '196dd32d-4f4c-12ae-63a4-94dd5d673c8f'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.027, + "Triggers": [], + "Execution Time": 0.02 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 90000, + "position": "middle", + "execution_ms": 0.017, + "planning_ms": 0.02, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 8.41, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 6233.77, + "Plan Rows": 39763, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.045001+00'::timestamp with time zone, '9608c03d-0a64-d881-4c17-5d0b327cb7e5'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.02, + "Triggers": [], + "Execution Time": 0.017 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 90000, + "position": "tail", + "execution_ms": 0.016, + "planning_ms": 0.017, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 79.25, + "Plan Rows": 41, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 79.25, + "Plan Rows": 41, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.007, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.089949+00'::timestamp with time zone, '62d50dce-8b88-97a6-c3ca-f675e48ee09a'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 10000, + "position": "head", + "execution_ms": 0.018, + "planning_ms": 0.019, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 22.58, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.013, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 4429.21, + "Plan Rows": 10191, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.01, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8f771595-16b0-a07f-31c3-79d136b2a3de'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.019, + "Triggers": [], + "Execution Time": 0.018 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 10000, + "position": "middle", + "execution_ms": 0.016, + "planning_ms": 0.017, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 24.97, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 4360.49, + "Plan Rows": 9058, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, '427c7fd3-6ea6-ffd4-bbd2-c6cdbb452719'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 10000, + "position": "tail", + "execution_ms": 0.016, + "planning_ms": 0.018, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 27.7, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 4299.69, + "Plan Rows": 8037, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009949+00'::timestamp with time zone, 'cd49e803-f71e-7ccb-ff7d-6b76a2a2e3d5'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.018, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 1000, + "position": "head", + "execution_ms": 0.018, + "planning_ms": 0.018, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 76.09, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.013, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 1510.89, + "Plan Rows": 1018, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.009, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '3765865a-ec55-3c2c-d202-d12cfedbcf7f'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.018, + "Triggers": [], + "Execution Time": 0.018 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 1000, + "position": "middle", + "execution_ms": 0.017, + "planning_ms": 0.016, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 76.38, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.013, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 1491.3, + "Plan Rows": 1001, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.009, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000501+00'::timestamp with time zone, '1db93204-3f0e-f6f7-aa5d-178875465c75'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.016, + "Triggers": [], + "Execution Time": 0.017 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 1000, + "position": "tail", + "execution_ms": 0.016, + "planning_ms": 0.017, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 76.63, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 1475.26, + "Plan Rows": 987, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000949+00'::timestamp with time zone, 'ee935a50-b6a6-429a-822c-7fbf4fabff8c'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 100, + "position": "head", + "execution_ms": 0.016, + "planning_ms": 0.014, + "shared_hits": 7, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 92.54, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 195.49, + "Plan Rows": 108, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8feb17b9-f3ba-823e-1bb2-6673b12b41c8'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.014, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 100, + "position": "middle", + "execution_ms": 0.015, + "planning_ms": 0.016, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 92.54, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.011, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 195.49, + "Plan Rows": 108, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.007, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000051+00'::timestamp with time zone, 'f89d4cb7-e52a-3f1e-e7c0-631a83fb8713'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.016, + "Triggers": [], + "Execution Time": 0.015 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 100, + "position": "tail", + "execution_ms": 0.016, + "planning_ms": 0.016, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 92.54, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 195.49, + "Plan Rows": 108, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000049+00'::timestamp with time zone, '94ed74f8-577f-2142-e435-3ec857c9c0d4'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.016, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 10, + "position": "head", + "execution_ms": 0.006, + "planning_ms": 0.013, + "shared_hits": 4, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 11.98, + "Plan Rows": 3, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.004, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 11.98, + "Plan Rows": 3, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.003, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 1, + "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": { + "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.013, + "Triggers": [], + "Execution Time": 0.006 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 10, + "position": "middle", + "execution_ms": 0.005, + "planning_ms": 0.013, + "shared_hits": 4, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 11.98, + "Plan Rows": 3, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.003, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 11.98, + "Plan Rows": 3, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.002, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000006+00'::timestamp with time zone, '07db7782-4351-7046-33b5-30864a334828'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 1, + "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": { + "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.013, + "Triggers": [], + "Execution Time": 0.005 + } + }, + { + "repeat": 1, + "variant": "keyset", + "chat_messages": 10, + "position": "tail", + "execution_ms": 0.006, + "planning_ms": 0.013, + "shared_hits": 4, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 11.98, + "Plan Rows": 3, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.003, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 11.98, + "Plan Rows": 3, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.002, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 1, + "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": { + "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.013, + "Triggers": [], + "Execution Time": 0.006 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 90000, + "position": "head", + "execution_ms": 0.021, + "planning_ms": 0.029, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 5.71, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.014, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 9347.15, + "Plan Rows": 90063, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.01, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '196dd32d-4f4c-12ae-63a4-94dd5d673c8f'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.029, + "Triggers": [], + "Execution Time": 0.021 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 90000, + "position": "middle", + "execution_ms": 0.018, + "planning_ms": 0.021, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 8.42, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 6294.37, + "Plan Rows": 40107, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.045001+00'::timestamp with time zone, '9608c03d-0a64-d881-4c17-5d0b327cb7e5'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.021, + "Triggers": [], + "Execution Time": 0.018 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 90000, + "position": "tail", + "execution_ms": 0.018, + "planning_ms": 0.026, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 82.79, + "Plan Rows": 43, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 82.79, + "Plan Rows": 43, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.089949+00'::timestamp with time zone, '62d50dce-8b88-97a6-c3ca-f675e48ee09a'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.026, + "Triggers": [], + "Execution Time": 0.018 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 10000, + "position": "head", + "execution_ms": 0.019, + "planning_ms": 0.019, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 23.33, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.014, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 4449.31, + "Plan Rows": 9901, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.01, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8f771595-16b0-a07f-31c3-79d136b2a3de'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.019, + "Triggers": [], + "Execution Time": 0.019 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 10000, + "position": "middle", + "execution_ms": 0.018, + "planning_ms": 0.021, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 25.78, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.013, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 4382.58, + "Plan Rows": 8811, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.009, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, '427c7fd3-6ea6-ffd4-bbd2-c6cdbb452719'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.021, + "Triggers": [], + "Execution Time": 0.018 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 10000, + "position": "tail", + "execution_ms": 0.017, + "planning_ms": 0.018, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 28.4, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 4324.73, + "Plan Rows": 7881, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009949+00'::timestamp with time zone, 'cd49e803-f71e-7ccb-ff7d-6b76a2a2e3d5'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.018, + "Triggers": [], + "Execution Time": 0.017 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 1000, + "position": "head", + "execution_ms": 0.02, + "planning_ms": 0.018, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 76.2, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.014, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 1522.06, + "Plan Rows": 1024, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.01, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '3765865a-ec55-3c2c-d202-d12cfedbcf7f'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.018, + "Triggers": [], + "Execution Time": 0.02 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 1000, + "position": "middle", + "execution_ms": 0.026, + "planning_ms": 0.02, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 76.46, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.019, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 1501.91, + "Plan Rows": 1007, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.014, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000501+00'::timestamp with time zone, '1db93204-3f0e-f6f7-aa5d-178875465c75'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.02, + "Triggers": [], + "Execution Time": 0.026 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 1000, + "position": "tail", + "execution_ms": 0.019, + "planning_ms": 0.017, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 76.63, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.013, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 1485.89, + "Plan Rows": 994, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.009, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000949+00'::timestamp with time zone, 'ee935a50-b6a6-429a-822c-7fbf4fabff8c'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.019 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 100, + "position": "head", + "execution_ms": 0.018, + "planning_ms": 0.017, + "shared_hits": 7, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 93.76, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.013, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 172.45, + "Plan Rows": 94, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.009, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8feb17b9-f3ba-823e-1bb2-6673b12b41c8'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.018 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 100, + "position": "middle", + "execution_ms": 0.014, + "planning_ms": 0.013, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 93.76, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.011, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 172.45, + "Plan Rows": 94, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.007, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000051+00'::timestamp with time zone, 'f89d4cb7-e52a-3f1e-e7c0-631a83fb8713'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.013, + "Triggers": [], + "Execution Time": 0.014 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 100, + "position": "tail", + "execution_ms": 0.016, + "planning_ms": 0.017, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 93.76, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 172.45, + "Plan Rows": 94, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.007, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000049+00'::timestamp with time zone, '94ed74f8-577f-2142-e435-3ec857c9c0d4'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 10, + "position": "head", + "execution_ms": 0.006, + "planning_ms": 0.013, + "shared_hits": 4, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 36.76, + "Plan Rows": 17, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.004, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 36.76, + "Plan Rows": 17, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.003, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 1, + "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": { + "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.013, + "Triggers": [], + "Execution Time": 0.006 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 10, + "position": "middle", + "execution_ms": 0.005, + "planning_ms": 0.013, + "shared_hits": 4, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 36.76, + "Plan Rows": 17, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.003, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 36.76, + "Plan Rows": 17, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.002, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000006+00'::timestamp with time zone, '07db7782-4351-7046-33b5-30864a334828'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 1, + "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": { + "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.013, + "Triggers": [], + "Execution Time": 0.005 + } + }, + { + "repeat": 2, + "variant": "keyset", + "chat_messages": 10, + "position": "tail", + "execution_ms": 0.006, + "planning_ms": 0.013, + "shared_hits": 4, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 36.76, + "Plan Rows": 17, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.003, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 36.76, + "Plan Rows": 17, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.002, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 1, + "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": { + "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.013, + "Triggers": [], + "Execution Time": 0.006 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 90000, + "position": "head", + "execution_ms": 22.44, + "planning_ms": 0.054, + "shared_hits": 2209, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 5997.44, + "Total Cost": 6003.25, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 21.07, + "Actual Total Time": 22.427, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 2209, + "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": 5997.44, + "Total Cost": 16233.59, + "Plan Rows": 89814, + "Plan Width": 137, + "Actual Startup Time": 21.07, + "Actual Total Time": 22.421, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Workers Planned": 1, + "Workers Launched": 1, + "Shared Hit Blocks": 2209, + "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": 4997.43, + "Total Cost": 5129.51, + "Plan Rows": 52832, + "Plan Width": 137, + "Actual Startup Time": 20.084, + "Actual Total Time": 20.087, + "Actual Rows": 51.0, + "Actual Loops": 2, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2209, + "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": 38, + "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": 3234.84, + "Plan Rows": 52832, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 3.952, + "Actual Rows": 44999.5, + "Actual Loops": 2, + "Disabled": false, + "Filter": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '196dd32d-4f4c-12ae-63a4-94dd5d673c8f'::uuid)))", + "Rows Removed by Filter": 5556, + "Shared Hit Blocks": 2194, + "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": 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.054, + "Triggers": [], + "Execution Time": 22.44 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 90000, + "position": "middle", + "execution_ms": 8.505, + "planning_ms": 0.067, + "shared_hits": 2209, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 5021.26, + "Total Cost": 5027.07, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 6.993, + "Actual Total Time": 8.491, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 2209, + "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": 5021.26, + "Total Cost": 9588.29, + "Plan Rows": 40072, + "Plan Width": 137, + "Actual Startup Time": 6.992, + "Actual Total Time": 8.476, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Workers Planned": 1, + "Workers Launched": 1, + "Shared Hit Blocks": 2209, + "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": 4021.25, + "Total Cost": 4080.18, + "Plan Rows": 23572, + "Plan Width": 137, + "Actual Startup Time": 5.412, + "Actual Total Time": 5.414, + "Actual Rows": 51.0, + "Actual Loops": 2, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2209, + "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": 38, + "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": 3234.84, + "Plan Rows": 23572, + "Plan Width": 137, + "Actual Startup Time": 1.218, + "Actual Total Time": 3.384, + "Actual Rows": 22499.5, + "Actual Loops": 2, + "Disabled": false, + "Filter": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.045001+00'::timestamp with time zone, '9608c03d-0a64-d881-4c17-5d0b327cb7e5'::uuid)))", + "Rows Removed by Filter": 28056, + "Shared Hit Blocks": 2194, + "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": 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.067, + "Triggers": [], + "Execution Time": 8.505 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 90000, + "position": "tail", + "execution_ms": 4.674, + "planning_ms": 0.057, + "shared_hits": 2194, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3964.73, + "Total Cost": 3964.85, + "Plan Rows": 47, + "Plan Width": 137, + "Actual Startup Time": 4.656, + "Actual Total Time": 4.663, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 2194, + "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": 3964.73, + "Total Cost": 3964.85, + "Plan Rows": 47, + "Plan Width": 137, + "Actual Startup Time": 4.655, + "Actual Total Time": 4.657, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2194, + "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": "messages", + "Alias": "messages", + "Startup Cost": 0.0, + "Total Cost": 3963.43, + "Plan Rows": 47, + "Plan Width": 137, + "Actual Startup Time": 4.165, + "Actual Total Time": 4.644, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Filter": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.089949+00'::timestamp with time zone, '62d50dce-8b88-97a6-c3ca-f675e48ee09a'::uuid)))", + "Rows Removed by Filter": 101059, + "Shared Hit Blocks": 2194, + "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.057, + "Triggers": [], + "Execution Time": 4.674 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 10000, + "position": "head", + "execution_ms": 1.801, + "planning_ms": 0.018, + "shared_hits": 224, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 838.02, + "Total Cost": 838.15, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 1.789, + "Actual Total Time": 1.795, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 224, + "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": 838.02, + "Total Cost": 863.59, + "Plan Rows": 10228, + "Plan Width": 137, + "Actual Startup Time": 1.789, + "Actual Total Time": 1.791, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 224, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 496.8, + "Plan Rows": 10228, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.97, + "Actual Rows": 9999.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8f771595-16b0-a07f-31c3-79d136b2a3de'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "Shared Hit Blocks": 224, + "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.018, + "Triggers": [], + "Execution Time": 1.801 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 10000, + "position": "middle", + "execution_ms": 1.198, + "planning_ms": 0.021, + "shared_hits": 224, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 799.96, + "Total Cost": 800.08, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 1.186, + "Actual Total Time": 1.192, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 224, + "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": 799.96, + "Total Cost": 822.67, + "Plan Rows": 9087, + "Plan Width": 137, + "Actual Startup Time": 1.185, + "Actual Total Time": 1.188, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 224, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 496.8, + "Plan Rows": 9087, + "Plan Width": 137, + "Actual Startup Time": 0.299, + "Actual Total Time": 0.779, + "Actual Rows": 4999.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, '427c7fd3-6ea6-ffd4-bbd2-c6cdbb452719'::uuid))", + "Rows Removed by Filter": 5001, + "Index Searches": 1, + "Shared Hit Blocks": 224, + "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.021, + "Triggers": [], + "Execution Time": 1.198 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 10000, + "position": "tail", + "execution_ms": 0.624, + "planning_ms": 0.018, + "shared_hits": 224, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 766.33, + "Total Cost": 766.46, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.612, + "Actual Total Time": 0.618, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 224, + "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": 766.33, + "Total Cost": 786.53, + "Plan Rows": 8079, + "Plan Width": 137, + "Actual Startup Time": 0.612, + "Actual Total Time": 0.614, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 224, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 496.8, + "Plan Rows": 8079, + "Plan Width": 137, + "Actual Startup Time": 0.602, + "Actual Total Time": 0.606, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.009949+00'::timestamp with time zone, 'cd49e803-f71e-7ccb-ff7d-6b76a2a2e3d5'::uuid))", + "Rows Removed by Filter": 9949, + "Index Searches": 1, + "Shared Hit Blocks": 224, + "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.018, + "Triggers": [], + "Execution Time": 0.624 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 1000, + "position": "head", + "execution_ms": 0.195, + "planning_ms": 0.018, + "shared_hits": 25, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 81.85, + "Total Cost": 81.98, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.183, + "Actual Total Time": 0.189, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 25, + "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": 81.85, + "Total Cost": 84.23, + "Plan Rows": 950, + "Plan Width": 137, + "Actual Startup Time": 0.183, + "Actual Total Time": 0.186, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 25, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 50.16, + "Plan Rows": 950, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.098, + "Actual Rows": 999.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '3765865a-ec55-3c2c-d202-d12cfedbcf7f'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "Shared Hit Blocks": 25, + "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.018, + "Triggers": [], + "Execution Time": 0.195 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 1000, + "position": "middle", + "execution_ms": 0.136, + "planning_ms": 0.017, + "shared_hits": 25, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 81.35, + "Total Cost": 81.48, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.125, + "Actual Total Time": 0.131, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 25, + "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": 81.35, + "Total Cost": 83.69, + "Plan Rows": 935, + "Plan Width": 137, + "Actual Startup Time": 0.125, + "Actual Total Time": 0.127, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 25, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 50.16, + "Plan Rows": 935, + "Plan Width": 137, + "Actual Startup Time": 0.034, + "Actual Total Time": 0.081, + "Actual Rows": 499.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000501+00'::timestamp with time zone, '1db93204-3f0e-f6f7-aa5d-178875465c75'::uuid))", + "Rows Removed by Filter": 501, + "Index Searches": 1, + "Shared Hit Blocks": 25, + "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.017, + "Triggers": [], + "Execution Time": 0.136 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 1000, + "position": "tail", + "execution_ms": 0.08, + "planning_ms": 0.017, + "shared_hits": 25, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 80.95, + "Total Cost": 81.08, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.07, + "Actual Total Time": 0.076, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 25, + "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": 80.95, + "Total Cost": 83.26, + "Plan Rows": 923, + "Plan Width": 137, + "Actual Startup Time": 0.069, + "Actual Total Time": 0.072, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 25, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 50.16, + "Plan Rows": 923, + "Plan Width": 137, + "Actual Startup Time": 0.059, + "Actual Total Time": 0.064, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000949+00'::timestamp with time zone, 'ee935a50-b6a6-429a-822c-7fbf4fabff8c'::uuid))", + "Rows Removed by Filter": 949, + "Index Searches": 1, + "Shared Hit Blocks": 25, + "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.017, + "Triggers": [], + "Execution Time": 0.08 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 100, + "position": "head", + "execution_ms": 0.034, + "planning_ms": 0.017, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.99, + "Total Cost": 16.12, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.023, + "Actual Total Time": 0.029, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.99, + "Total Cost": 16.24, + "Plan Rows": 101, + "Plan Width": 137, + "Actual Startup Time": 0.023, + "Actual Total Time": 0.025, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 50, + "Sort Space Type": "Memory", + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 12.63, + "Plan Rows": 101, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.013, + "Actual Rows": 99.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8feb17b9-f3ba-823e-1bb2-6673b12b41c8'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 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 + } + ] + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.034 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 100, + "position": "middle", + "execution_ms": 0.026, + "planning_ms": 0.017, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.99, + "Total Cost": 16.12, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.016, + "Actual Total Time": 0.022, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "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": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.99, + "Total Cost": 16.24, + "Plan Rows": 101, + "Plan Width": 137, + "Actual Startup Time": 0.016, + "Actual Total Time": 0.018, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 37, + "Sort Space Type": "Memory", + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 12.63, + "Plan Rows": 101, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.011, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000051+00'::timestamp with time zone, 'f89d4cb7-e52a-3f1e-e7c0-631a83fb8713'::uuid))", + "Rows Removed by Filter": 51, + "Index Searches": 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 + } + ] + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.026 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 100, + "position": "tail", + "execution_ms": 0.027, + "planning_ms": 0.017, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.99, + "Total Cost": 16.12, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.016, + "Actual Total Time": 0.022, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.99, + "Total Cost": 16.24, + "Plan Rows": 101, + "Plan Width": 137, + "Actual Startup Time": 0.016, + "Actual Total Time": 0.018, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 12.63, + "Plan Rows": 101, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000049+00'::timestamp with time zone, '94ed74f8-577f-2142-e435-3ec857c9c0d4'::uuid))", + "Rows Removed by Filter": 49, + "Index Searches": 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 + } + ] + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.027 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 10, + "position": "head", + "execution_ms": 0.011, + "planning_ms": 0.017, + "shared_hits": 3, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.55, + "Total Cost": 8.57, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.007, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.55, + "Total Cost": 8.57, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.006, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 27, + "Sort Space Type": "Memory", + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 8.45, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.004, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "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.017, + "Triggers": [], + "Execution Time": 0.011 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 10, + "position": "middle", + "execution_ms": 0.008, + "planning_ms": 0.016, + "shared_hits": 3, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.55, + "Total Cost": 8.57, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.005, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.55, + "Total Cost": 8.57, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.005, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 26, + "Sort Space Type": "Memory", + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 8.45, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.003, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000006+00'::timestamp with time zone, '07db7782-4351-7046-33b5-30864a334828'::uuid))", + "Rows Removed by Filter": 6, + "Index Searches": 1, + "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.016, + "Triggers": [], + "Execution Time": 0.008 + } + }, + { + "repeat": 2, + "variant": "chat_only", + "chat_messages": 10, + "position": "tail", + "execution_ms": 0.01, + "planning_ms": 0.016, + "shared_hits": 3, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.55, + "Total Cost": 8.57, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.006, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.55, + "Total Cost": 8.57, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.005, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 27, + "Sort Space Type": "Memory", + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 8.45, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.002, + "Actual Total Time": 0.003, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "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.016, + "Triggers": [], + "Execution Time": 0.01 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 90000, + "position": "head", + "execution_ms": 16.501, + "planning_ms": 0.085, + "shared_hits": 2209, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 6004.78, + "Total Cost": 6010.59, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 15.2, + "Actual Total Time": 16.471, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 2209, + "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": 6004.78, + "Total Cost": 16283.56, + "Plan Rows": 90188, + "Plan Width": 137, + "Actual Startup Time": 15.199, + "Actual Total Time": 16.463, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Workers Planned": 1, + "Workers Launched": 1, + "Shared Hit Blocks": 2209, + "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": 5004.77, + "Total Cost": 5137.4, + "Plan Rows": 53052, + "Plan Width": 137, + "Actual Startup Time": 10.406, + "Actual Total Time": 10.41, + "Actual Rows": 51.0, + "Actual Loops": 2, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2209, + "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": 38, + "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": 3234.84, + "Plan Rows": 53052, + "Plan Width": 137, + "Actual Startup Time": 0.01, + "Actual Total Time": 4.798, + "Actual Rows": 44999.5, + "Actual Loops": 2, + "Disabled": false, + "Filter": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '196dd32d-4f4c-12ae-63a4-94dd5d673c8f'::uuid)))", + "Rows Removed by Filter": 5556, + "Shared Hit Blocks": 2194, + "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": 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.085, + "Triggers": [], + "Execution Time": 16.501 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 90000, + "position": "middle", + "execution_ms": 7.082, + "planning_ms": 0.055, + "shared_hits": 2209, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 5025.16, + "Total Cost": 5030.98, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 6.001, + "Actual Total Time": 7.069, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 2209, + "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": 5025.16, + "Total Cost": 9614.87, + "Plan Rows": 40271, + "Plan Width": 137, + "Actual Startup Time": 6.0, + "Actual Total Time": 7.064, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Workers Planned": 1, + "Workers Launched": 1, + "Shared Hit Blocks": 2209, + "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": 4025.15, + "Total Cost": 4084.38, + "Plan Rows": 23689, + "Plan Width": 137, + "Actual Startup Time": 4.963, + "Actual Total Time": 4.965, + "Actual Rows": 38.5, + "Actual Loops": 2, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2209, + "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": 38, + "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": 3234.84, + "Plan Rows": 23689, + "Plan Width": 137, + "Actual Startup Time": 1.077, + "Actual Total Time": 3.094, + "Actual Rows": 22499.5, + "Actual Loops": 2, + "Disabled": false, + "Filter": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.045001+00'::timestamp with time zone, '9608c03d-0a64-d881-4c17-5d0b327cb7e5'::uuid)))", + "Rows Removed by Filter": 28056, + "Shared Hit Blocks": 2194, + "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": 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.055, + "Triggers": [], + "Execution Time": 7.082 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 90000, + "position": "tail", + "execution_ms": 4.282, + "planning_ms": 0.05, + "shared_hits": 2194, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3964.63, + "Total Cost": 3964.74, + "Plan Rows": 44, + "Plan Width": 137, + "Actual Startup Time": 4.264, + "Actual Total Time": 4.271, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 2194, + "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": 3964.63, + "Total Cost": 3964.74, + "Plan Rows": 44, + "Plan Width": 137, + "Actual Startup Time": 4.263, + "Actual Total Time": 4.266, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2194, + "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": "messages", + "Alias": "messages", + "Startup Cost": 0.0, + "Total Cost": 3963.43, + "Plan Rows": 44, + "Plan Width": 137, + "Actual Startup Time": 3.826, + "Actual Total Time": 4.254, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Filter": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.089949+00'::timestamp with time zone, '62d50dce-8b88-97a6-c3ca-f675e48ee09a'::uuid)))", + "Rows Removed by Filter": 101059, + "Shared Hit Blocks": 2194, + "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.05, + "Triggers": [], + "Execution Time": 4.282 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 10000, + "position": "head", + "execution_ms": 1.755, + "planning_ms": 0.021, + "shared_hits": 224, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 810.33, + "Total Cost": 810.46, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 1.743, + "Actual Total Time": 1.749, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 224, + "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": 810.33, + "Total Cost": 835.12, + "Plan Rows": 9915, + "Plan Width": 137, + "Actual Startup Time": 1.743, + "Actual Total Time": 1.745, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 224, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 479.55, + "Plan Rows": 9915, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.922, + "Actual Rows": 9999.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8f771595-16b0-a07f-31c3-79d136b2a3de'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "Shared Hit Blocks": 224, + "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.021, + "Triggers": [], + "Execution Time": 1.755 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 10000, + "position": "middle", + "execution_ms": 1.17, + "planning_ms": 0.017, + "shared_hits": 224, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 775.07, + "Total Cost": 775.2, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 1.159, + "Actual Total Time": 1.165, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 224, + "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": 775.07, + "Total Cost": 797.21, + "Plan Rows": 8858, + "Plan Width": 137, + "Actual Startup Time": 1.159, + "Actual Total Time": 1.161, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 224, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 479.55, + "Plan Rows": 8858, + "Plan Width": 137, + "Actual Startup Time": 0.298, + "Actual Total Time": 0.747, + "Actual Rows": 4999.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, '427c7fd3-6ea6-ffd4-bbd2-c6cdbb452719'::uuid))", + "Rows Removed by Filter": 5001, + "Index Searches": 1, + "Shared Hit Blocks": 224, + "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.017, + "Triggers": [], + "Execution Time": 1.17 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 10000, + "position": "tail", + "execution_ms": 0.603, + "planning_ms": 0.018, + "shared_hits": 224, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 742.71, + "Total Cost": 742.84, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.591, + "Actual Total Time": 0.597, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 224, + "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": 742.71, + "Total Cost": 762.43, + "Plan Rows": 7888, + "Plan Width": 137, + "Actual Startup Time": 0.591, + "Actual Total Time": 0.594, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 224, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 479.55, + "Plan Rows": 7888, + "Plan Width": 137, + "Actual Startup Time": 0.581, + "Actual Total Time": 0.586, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.009949+00'::timestamp with time zone, 'cd49e803-f71e-7ccb-ff7d-6b76a2a2e3d5'::uuid))", + "Rows Removed by Filter": 9949, + "Index Searches": 1, + "Shared Hit Blocks": 224, + "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.018, + "Triggers": [], + "Execution Time": 0.603 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 1000, + "position": "head", + "execution_ms": 0.197, + "planning_ms": 0.021, + "shared_hits": 25, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 77.97, + "Total Cost": 78.09, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.185, + "Actual Total Time": 0.191, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 25, + "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": 77.97, + "Total Cost": 80.22, + "Plan Rows": 900, + "Plan Width": 137, + "Actual Startup Time": 0.185, + "Actual Total Time": 0.187, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 25, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 47.94, + "Plan Rows": 900, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.099, + "Actual Rows": 999.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '3765865a-ec55-3c2c-d202-d12cfedbcf7f'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "Shared Hit Blocks": 25, + "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.021, + "Triggers": [], + "Execution Time": 0.197 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 1000, + "position": "middle", + "execution_ms": 0.158, + "planning_ms": 0.029, + "shared_hits": 25, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 77.53, + "Total Cost": 77.66, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.144, + "Actual Total Time": 0.15, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 25, + "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": 77.53, + "Total Cost": 79.75, + "Plan Rows": 887, + "Plan Width": 137, + "Actual Startup Time": 0.144, + "Actual Total Time": 0.146, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 25, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 47.94, + "Plan Rows": 887, + "Plan Width": 137, + "Actual Startup Time": 0.044, + "Actual Total Time": 0.095, + "Actual Rows": 499.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000501+00'::timestamp with time zone, '1db93204-3f0e-f6f7-aa5d-178875465c75'::uuid))", + "Rows Removed by Filter": 501, + "Index Searches": 1, + "Shared Hit Blocks": 25, + "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.029, + "Triggers": [], + "Execution Time": 0.158 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 1000, + "position": "tail", + "execution_ms": 0.092, + "planning_ms": 0.024, + "shared_hits": 25, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 77.13, + "Total Cost": 77.26, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.079, + "Actual Total Time": 0.085, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Shared Hit Blocks": 25, + "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": 77.13, + "Total Cost": 79.32, + "Plan Rows": 875, + "Plan Width": 137, + "Actual Startup Time": 0.078, + "Actual Total Time": 0.081, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 25, + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 47.94, + "Plan Rows": 875, + "Plan Width": 137, + "Actual Startup Time": 0.067, + "Actual Total Time": 0.072, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000949+00'::timestamp with time zone, 'ee935a50-b6a6-429a-822c-7fbf4fabff8c'::uuid))", + "Rows Removed by Filter": 949, + "Index Searches": 1, + "Shared Hit Blocks": 25, + "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.024, + "Triggers": [], + "Execution Time": 0.092 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 100, + "position": "head", + "execution_ms": 0.038, + "planning_ms": 0.021, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.79, + "Total Cost": 15.92, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.025, + "Actual Total Time": 0.032, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.79, + "Total Cost": 16.03, + "Plan Rows": 98, + "Plan Width": 137, + "Actual Startup Time": 0.025, + "Actual Total Time": 0.028, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 50, + "Sort Space Type": "Memory", + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 12.55, + "Plan Rows": 98, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.015, + "Actual Rows": 99.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8feb17b9-f3ba-823e-1bb2-6673b12b41c8'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 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 + } + ] + } + ] + }, + "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.021, + "Triggers": [], + "Execution Time": 0.038 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 100, + "position": "middle", + "execution_ms": 0.034, + "planning_ms": 0.028, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.79, + "Total Cost": 15.92, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.021, + "Actual Total Time": 0.027, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "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": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.79, + "Total Cost": 16.03, + "Plan Rows": 98, + "Plan Width": 137, + "Actual Startup Time": 0.02, + "Actual Total Time": 0.023, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 37, + "Sort Space Type": "Memory", + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 12.55, + "Plan Rows": 98, + "Plan Width": 137, + "Actual Startup Time": 0.009, + "Actual Total Time": 0.014, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000051+00'::timestamp with time zone, 'f89d4cb7-e52a-3f1e-e7c0-631a83fb8713'::uuid))", + "Rows Removed by Filter": 51, + "Index Searches": 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 + } + ] + } + ] + }, + "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.028, + "Triggers": [], + "Execution Time": 0.034 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 100, + "position": "tail", + "execution_ms": 0.028, + "planning_ms": 0.017, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.79, + "Total Cost": 15.92, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.017, + "Actual Total Time": 0.023, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 15.79, + "Total Cost": 16.03, + "Plan Rows": 98, + "Plan Width": 137, + "Actual Startup Time": 0.017, + "Actual Total Time": 0.019, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 38, + "Sort Space Type": "Memory", + "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_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 12.55, + "Plan Rows": 98, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000049+00'::timestamp with time zone, '94ed74f8-577f-2142-e435-3ec857c9c0d4'::uuid))", + "Rows Removed by Filter": 49, + "Index Searches": 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 + } + ] + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.028 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 10, + "position": "head", + "execution_ms": 0.015, + "planning_ms": 0.022, + "shared_hits": 3, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.33, + "Total Cost": 8.33, + "Plan Rows": 1, + "Plan Width": 137, + "Actual Startup Time": 0.008, + "Actual Total Time": 0.01, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.33, + "Total Cost": 8.33, + "Plan Rows": 1, + "Plan Width": 137, + "Actual Startup Time": 0.008, + "Actual Total Time": 0.009, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 27, + "Sort Space Type": "Memory", + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 8.32, + "Plan Rows": 1, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.004, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "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.022, + "Triggers": [], + "Execution Time": 0.015 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 10, + "position": "middle", + "execution_ms": 0.013, + "planning_ms": 0.022, + "shared_hits": 3, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.33, + "Total Cost": 8.33, + "Plan Rows": 1, + "Plan Width": 137, + "Actual Startup Time": 0.008, + "Actual Total Time": 0.008, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.33, + "Total Cost": 8.33, + "Plan Rows": 1, + "Plan Width": 137, + "Actual Startup Time": 0.007, + "Actual Total Time": 0.008, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 26, + "Sort Space Type": "Memory", + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 8.32, + "Plan Rows": 1, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.006, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000006+00'::timestamp with time zone, '07db7782-4351-7046-33b5-30864a334828'::uuid))", + "Rows Removed by Filter": 6, + "Index Searches": 1, + "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.022, + "Triggers": [], + "Execution Time": 0.013 + } + }, + { + "repeat": 3, + "variant": "chat_only", + "chat_messages": 10, + "position": "tail", + "execution_ms": 0.011, + "planning_ms": 0.018, + "shared_hits": 3, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.33, + "Total Cost": 8.33, + "Plan Rows": 1, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.007, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 8.33, + "Total Cost": 8.33, + "Plan Rows": 1, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.006, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "quicksort", + "Sort Space Used": 27, + "Sort Space Type": "Memory", + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_only_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.29, + "Total Cost": 8.32, + "Plan Rows": 1, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.004, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "(chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "(ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid))", + "Rows Removed by Filter": 1, + "Index Searches": 1, + "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.018, + "Triggers": [], + "Execution Time": 0.011 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 90000, + "position": "head", + "execution_ms": 0.019, + "planning_ms": 0.026, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 5.72, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.013, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 9315.2, + "Plan Rows": 89574, + "Plan Width": 137, + "Actual Startup Time": 0.006, + "Actual Total Time": 0.01, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '196dd32d-4f4c-12ae-63a4-94dd5d673c8f'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.026, + "Triggers": [], + "Execution Time": 0.019 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 90000, + "position": "middle", + "execution_ms": 0.016, + "planning_ms": 0.019, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 8.48, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 6261.93, + "Plan Rows": 39593, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.045001+00'::timestamp with time zone, '9608c03d-0a64-d881-4c17-5d0b327cb7e5'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.019, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 90000, + "position": "tail", + "execution_ms": 0.016, + "planning_ms": 0.017, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 86.33, + "Plan Rows": 45, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 86.33, + "Plan Rows": 45, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.007, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '468ff366-6541-5727-bea4-71b18f644552'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.089949+00'::timestamp with time zone, '62d50dce-8b88-97a6-c3ca-f675e48ee09a'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 10000, + "position": "head", + "execution_ms": 0.019, + "planning_ms": 0.021, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 22.48, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.014, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 4475.86, + "Plan Rows": 10346, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.01, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8f771595-16b0-a07f-31c3-79d136b2a3de'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.021, + "Triggers": [], + "Execution Time": 0.019 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 10000, + "position": "middle", + "execution_ms": 0.016, + "planning_ms": 0.018, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 24.89, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 4406.52, + "Plan Rows": 9182, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, '427c7fd3-6ea6-ffd4-bbd2-c6cdbb452719'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.018, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 10000, + "position": "tail", + "execution_ms": 0.016, + "planning_ms": 0.017, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 27.54, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 4341.78, + "Plan Rows": 8164, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'd493110c-73ef-5035-8aa2-5377ded2c82a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009949+00'::timestamp with time zone, 'cd49e803-f71e-7ccb-ff7d-6b76a2a2e3d5'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 1000, + "position": "head", + "execution_ms": 0.016, + "planning_ms": 0.017, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 75.42, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 1581.41, + "Plan Rows": 1075, + "Plan Width": 137, + "Actual Startup Time": 0.005, + "Actual Total Time": 0.008, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '3765865a-ec55-3c2c-d202-d12cfedbcf7f'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 1000, + "position": "middle", + "execution_ms": 0.032, + "planning_ms": 0.018, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 75.66, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.028, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 1561.26, + "Plan Rows": 1058, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000501+00'::timestamp with time zone, '1db93204-3f0e-f6f7-aa5d-178875465c75'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.018, + "Triggers": [], + "Execution Time": 0.032 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 1000, + "position": "tail", + "execution_ms": 0.015, + "planning_ms": 0.017, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 75.87, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 1543.45, + "Plan Rows": 1043, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.007, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'f689a37a-3ac0-57e3-a9aa-e8b098a59715'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000949+00'::timestamp with time zone, 'ee935a50-b6a6-429a-822c-7fbf4fabff8c'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.015 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 100, + "position": "head", + "execution_ms": 0.016, + "planning_ms": 0.016, + "shared_hits": 7, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 92.72, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.012, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 177.79, + "Plan Rows": 98, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.009, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '8feb17b9-f3ba-823e-1bb2-6673b12b41c8'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.016, + "Triggers": [], + "Execution Time": 0.016 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 100, + "position": "middle", + "execution_ms": 0.015, + "planning_ms": 0.017, + "shared_hits": 5, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 92.72, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.004, + "Actual Total Time": 0.011, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "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": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 177.79, + "Plan Rows": 98, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.007, + "Actual Rows": 49.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000051+00'::timestamp with time zone, 'f89d4cb7-e52a-3f1e-e7c0-631a83fb8713'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.017, + "Triggers": [], + "Execution Time": 0.015 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 100, + "position": "tail", + "execution_ms": 0.015, + "planning_ms": 0.016, + "shared_hits": 6, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 92.72, + "Plan Rows": 51, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.011, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "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_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 177.79, + "Plan Rows": 98, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.007, + "Actual Rows": 51.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = '8797cadb-6440-5be1-80e1-d5b6c1e2aa83'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000049+00'::timestamp with time zone, '94ed74f8-577f-2142-e435-3ec857c9c0d4'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 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 + } + ] + }, + "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.016, + "Triggers": [], + "Execution Time": 0.015 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 10, + "position": "head", + "execution_ms": 0.008, + "planning_ms": 0.016, + "shared_hits": 4, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 19.06, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.004, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 19.06, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.003, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 1, + "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": { + "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.016, + "Triggers": [], + "Execution Time": 0.008 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 10, + "position": "middle", + "execution_ms": 0.007, + "planning_ms": 0.016, + "shared_hits": 4, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 19.06, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.004, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 19.06, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.003, + "Actual Rows": 4.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000006+00'::timestamp with time zone, '07db7782-4351-7046-33b5-30864a334828'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 1, + "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": { + "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.016, + "Triggers": [], + "Execution Time": 0.007 + } + }, + { + "repeat": 3, + "variant": "keyset", + "chat_messages": 10, + "position": "tail", + "execution_ms": 0.007, + "planning_ms": 0.016, + "shared_hits": 4, + "shared_reads": 0, + "plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.42, + "Total Cost": 19.06, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.004, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "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, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_history_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.42, + "Total Cost": 19.06, + "Plan Rows": 7, + "Plan Width": 137, + "Actual Startup Time": 0.003, + "Actual Total Time": 0.003, + "Actual Rows": 9.0, + "Actual Loops": 1, + "Disabled": false, + "Index Cond": "((chat_id = 'cdcaab81-d05d-5023-a5b9-211e34546575'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.000001+00'::timestamp with time zone, '191119ab-ea6c-353a-53f1-5a08381a51d1'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Index Searches": 1, + "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": { + "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.016, + "Triggers": [], + "Execution Time": 0.007 + } + } + ], + "writes": [ + { + "repeat": 1, + "variant": "chat_only", + "inserted": 1000, + "insert_and_commit_seconds": 0.04397549999998773, + "wal_bytes": 358504 + }, + { + "repeat": 1, + "variant": "keyset", + "inserted": 1000, + "insert_and_commit_seconds": 0.011545625000053406, + "wal_bytes": 449584 + }, + { + "repeat": 2, + "variant": "keyset", + "inserted": 1000, + "insert_and_commit_seconds": 0.011664166999935333, + "wal_bytes": 423968 + }, + { + "repeat": 2, + "variant": "chat_only", + "inserted": 1000, + "insert_and_commit_seconds": 0.010450624999975844, + "wal_bytes": 347536 + }, + { + "repeat": 3, + "variant": "chat_only", + "inserted": 1000, + "insert_and_commit_seconds": 0.03753299999993942, + "wal_bytes": 347512 + }, + { + "repeat": 3, + "variant": "keyset", + "inserted": 1000, + "insert_and_commit_seconds": 0.010640291999834517, + "wal_bytes": 427672 + } + ], + "indexes": [ + { + "repeat": 1, + "variant": "chat_only", + "bytes": 729088 + }, + { + "repeat": 1, + "variant": "keyset", + "bytes": 5980160 + }, + { + "repeat": 2, + "variant": "keyset", + "bytes": 5980160 + }, + { + "repeat": 2, + "variant": "chat_only", + "bytes": 729088 + }, + { + "repeat": 3, + "variant": "chat_only", + "bytes": 729088 + }, + { + "repeat": 3, + "variant": "keyset", + "bytes": 5980160 + } + ], + "snapshot_before_backup": { + "counts": { + "users": 1, + "chats": 5, + "members": 5, + "messages": 101110, + "sessions": 0, + "schema_migrations": 1 + }, + "messages_sha256": "6c0ec16decee087519040f3400cf01779457313456c601f5e766c89a23a39db2", + "selected_messages": [ + [ + "196dd32d-4f4c-12ae-63a4-94dd5d673c8f", + "468ff366-6541-5727-bea4-71b18f644552", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "9608c03d-0a64-d881-4c17-5d0b327cb7e5", + "468ff366-6541-5727-bea4-71b18f644552", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 45001xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.045001+00:00" + ], + [ + "55fc8a6b-0da3-4f2f-0768-f098152bb0f9", + "468ff366-6541-5727-bea4-71b18f644552", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 90000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.090000+00:00" + ], + [ + "8f771595-16b0-a07f-31c3-79d136b2a3de", + "d493110c-73ef-5035-8aa2-5377ded2c82a", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "427c7fd3-6ea6-ffd4-bbd2-c6cdbb452719", + "d493110c-73ef-5035-8aa2-5377ded2c82a", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 5001xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.005001+00:00" + ], + [ + "ce8cdf2d-4cda-9ce7-c52e-badbe55dc2d6", + "d493110c-73ef-5035-8aa2-5377ded2c82a", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 10000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.010000+00:00" + ], + [ + "3765865a-ec55-3c2c-d202-d12cfedbcf7f", + "f689a37a-3ac0-57e3-a9aa-e8b098a59715", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "1db93204-3f0e-f6f7-aa5d-178875465c75", + "f689a37a-3ac0-57e3-a9aa-e8b098a59715", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 501xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000501+00:00" + ], + [ + "4916b9d8-a4a9-85bd-7c53-2220dc15bd96", + "f689a37a-3ac0-57e3-a9aa-e8b098a59715", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.001000+00:00" + ], + [ + "8feb17b9-f3ba-823e-1bb2-6673b12b41c8", + "8797cadb-6440-5be1-80e1-d5b6c1e2aa83", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "f89d4cb7-e52a-3f1e-e7c0-631a83fb8713", + "8797cadb-6440-5be1-80e1-d5b6c1e2aa83", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 51xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000051+00:00" + ], + [ + "7b170d3d-df2a-38ca-9530-d3c52aa63214", + "8797cadb-6440-5be1-80e1-d5b6c1e2aa83", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 100xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000100+00:00" + ], + [ + "191119ab-ea6c-353a-53f1-5a08381a51d1", + "cdcaab81-d05d-5023-a5b9-211e34546575", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "07db7782-4351-7046-33b5-30864a334828", + "cdcaab81-d05d-5023-a5b9-211e34546575", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000006+00:00" + ], + [ + "284675e3-8fd0-1686-c666-7731a6e3d8ab", + "cdcaab81-d05d-5023-a5b9-211e34546575", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 10xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000010+00:00" + ] + ] + }, + "research_worker_maxrss_kib": 45232, + "backup_seconds": 0.4796167499880539, + "backup_bytes": 3026259, + "restore_seconds": 0.6642069579975214, + "restore_verification": { + "snapshot_equal": true, + "selected_messages_checked": 15, + "restored": { + "counts": { + "users": 1, + "chats": 5, + "members": 5, + "messages": 101110, + "sessions": 0, + "schema_migrations": 1 + }, + "messages_sha256": "6c0ec16decee087519040f3400cf01779457313456c601f5e766c89a23a39db2", + "selected_messages": [ + [ + "196dd32d-4f4c-12ae-63a4-94dd5d673c8f", + "468ff366-6541-5727-bea4-71b18f644552", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "9608c03d-0a64-d881-4c17-5d0b327cb7e5", + "468ff366-6541-5727-bea4-71b18f644552", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 45001xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.045001+00:00" + ], + [ + "55fc8a6b-0da3-4f2f-0768-f098152bb0f9", + "468ff366-6541-5727-bea4-71b18f644552", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 90000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.090000+00:00" + ], + [ + "8f771595-16b0-a07f-31c3-79d136b2a3de", + "d493110c-73ef-5035-8aa2-5377ded2c82a", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "427c7fd3-6ea6-ffd4-bbd2-c6cdbb452719", + "d493110c-73ef-5035-8aa2-5377ded2c82a", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 5001xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.005001+00:00" + ], + [ + "ce8cdf2d-4cda-9ce7-c52e-badbe55dc2d6", + "d493110c-73ef-5035-8aa2-5377ded2c82a", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 10000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.010000+00:00" + ], + [ + "3765865a-ec55-3c2c-d202-d12cfedbcf7f", + "f689a37a-3ac0-57e3-a9aa-e8b098a59715", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "1db93204-3f0e-f6f7-aa5d-178875465c75", + "f689a37a-3ac0-57e3-a9aa-e8b098a59715", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 501xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000501+00:00" + ], + [ + "4916b9d8-a4a9-85bd-7c53-2220dc15bd96", + "f689a37a-3ac0-57e3-a9aa-e8b098a59715", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.001000+00:00" + ], + [ + "8feb17b9-f3ba-823e-1bb2-6673b12b41c8", + "8797cadb-6440-5be1-80e1-d5b6c1e2aa83", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "f89d4cb7-e52a-3f1e-e7c0-631a83fb8713", + "8797cadb-6440-5be1-80e1-d5b6c1e2aa83", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 51xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000051+00:00" + ], + [ + "7b170d3d-df2a-38ca-9530-d3c52aa63214", + "8797cadb-6440-5be1-80e1-d5b6c1e2aa83", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 100xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000100+00:00" + ], + [ + "191119ab-ea6c-353a-53f1-5a08381a51d1", + "cdcaab81-d05d-5023-a5b9-211e34546575", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000001+00:00" + ], + [ + "07db7782-4351-7046-33b5-30864a334828", + "cdcaab81-d05d-5023-a5b9-211e34546575", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000006+00:00" + ], + [ + "284675e3-8fd0-1686-c666-7731a6e3d8ab", + "cdcaab81-d05d-5023-a5b9-211e34546575", + "d4247ecd-40ba-5c2d-b65c-56e6db73e730", + "message 10xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "2026-01-01 00:00:00.000010+00:00" + ] + ] + }, + "post_snapshot_commits_not_restored": 1, + "source_count_after_backup": 101111, + "post_snapshot_message": "8cfa1d70-e8d0-4b4c-91ae-172f7fff00c6" + }, + "postgres_cgroup_memory_current": 252526592, + "postgres_cgroup_memory_peak": 266039296, + "result": "PASS" +} diff --git a/pyproject.toml b/pyproject.toml index 9216712..27e019a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,11 @@ select = ["E", "F", "I", "B", "UP"] [tool.ruff.per-file-target-version] "scripts/*.py" = "py39" +# SQL и генерируемые Markdown-таблицы в инструментах не разрываем. +[tool.ruff.lint.per-file-ignores] +"research/*.py" = ["E501"] +"scripts/*.py" = ["E501"] + [tool.pytest.ini_options] testpaths = ["student-tests"] addopts = "-ra" diff --git a/research/analyze.py b/research/analyze.py new file mode 100644 index 0000000..8e082e4 --- /dev/null +++ b/research/analyze.py @@ -0,0 +1,134 @@ +import argparse +import csv +import json +import statistics +from collections import defaultdict +from pathlib import Path + +import matplotlib + +matplotlib.use("Agg") +import matplotlib.pyplot as plt # noqa: E402 + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("input", type=Path) + args = parser.parse_args() + result = json.loads(args.input.read_text()) + groups = defaultdict(list) + for row in result["reads"]: + groups[(row["chat_messages"], row["position"], row["variant"])].append( + row + ) + rows = [] + for (size, position, variant), values in sorted(groups.items()): + ms = [v["execution_ms"] for v in values] + rows.append( + { + "messages": size, + "position": position, + "variant": variant, + "repeats": len(values), + "median_sql_ms": statistics.median(ms), + "min_sql_ms": min(ms), + "max_sql_ms": max(ms), + "median_buffers": statistics.median( + v["shared_hits"] + v["shared_reads"] for v in values + ), + } + ) + directory = args.input.parent + with (directory / "query-summary.csv").open("w") as stream: + writer = csv.DictWriter( + stream, fieldnames=list(rows[0]), lineterminator="\n" + ) + writer.writeheader() + writer.writerows(rows) + lines = [ + "# Планы запросов и восстановление", + "", + "Три повтора, 101110 сообщений в 5 неравномерных чатах.", + "", + "| Индекс | SQL середины чата90k, мс | Буферы | Размер, bytes | INSERT+COMMIT1000, мс | WAL, bytes |", + "|---|---:|---:|---:|---:|---:|", + ] + for variant in ["chat_only", "keyset"]: + read = next( + r + for r in rows + if r["messages"] == 90000 + and r["position"] == "middle" + and r["variant"] == variant + ) + writes = [r for r in result["writes"] if r["variant"] == variant] + index_bytes = statistics.median( + r["bytes"] for r in result["indexes"] if r["variant"] == variant + ) + latency = statistics.median( + r["insert_and_commit_seconds"] * 1000 for r in writes + ) + wal = statistics.median(r["wal_bytes"] for r in writes) + lines.append( + f"| {variant} | {read['median_sql_ms']:.3f} | {read['median_buffers']:.0f} | {index_bytes:.0f} | {latency:.2f} | {wal:.0f} |" + ) + lines.extend( + [ + "", + f"Dump: {result['backup_seconds']:.3f} s, {result['backup_bytes']} bytes.", + f"Restore в новую БД: {result['restore_seconds']:.3f} s.", + "Проверены count всех таблиц, SHA-256 всей истории и 15 полных сообщений.", + "Одна отдельная SQL-запись после snapshot не восстановлена — ожидаемая", + "граница snapshot backup. Это не HTTP RPO и не гарантия HA.", + "", + "Время EXPLAIN — SQL execution time, не HTTP latency. Цена записи включает", + "COMMIT 1000 строк; WAL — глобальный счётчик PG и может включать фон.", + "Индекс keyset больше и даёт больше WAL, но в этом опыте INSERT быстрее:", + "гипотеза роста именно времени записи не подтвердилась. Причина механизма", + "такого различия отдельно не профилировалась.", + ] + ) + (directory / "query-summary.md").write_text("\n".join(lines) + "\n") + fig, axes = plt.subplots(1, 2, figsize=(10, 4)) + for variant in ["chat_only", "keyset"]: + selected = sorted( + ( + r + for r in rows + if r["variant"] == variant and r["position"] == "middle" + ), + key=lambda r: r["messages"], + ) + sizes = [r["messages"] for r in selected] + axes[0].plot( + sizes, + [r["median_sql_ms"] for r in selected], + marker="o", + label=variant, + ) + axes[1].plot( + sizes, + [r["median_buffers"] for r in selected], + marker="o", + label=variant, + ) + for ax, ylabel in zip( + axes, ["SQL execution time, ms", "Shared buffers touched"], strict=True + ): + ax.set_xscale("log") + ax.set_yscale("log") + ax.set_xlabel("Messages in chat") + ax.set_ylabel(ylabel) + ax.grid(alpha=0.3) + ax.legend() + fig.suptitle( + "PostgreSQL 1 CPU / 512 MiB; midpoint keyset page; median of 3" + ) + fig.tight_layout() + fig.savefig(directory / "query-plans.png", dpi=150) + plt.close(fig) + print("\n".join(lines)) + + +if __name__ == "__main__": + main() diff --git a/scripts/verify_pool.py b/scripts/verify_pool.py new file mode 100644 index 0000000..853dd6f --- /dev/null +++ b/scripts/verify_pool.py @@ -0,0 +1,116 @@ +import argparse +import json +import time +from concurrent.futures import ThreadPoolExecutor +from datetime import UTC, datetime +from pathlib import Path +from uuid import uuid4 + +import httpx + +from scripts.stand import actor, auth, command, extra_api, sql + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--output", required=True) + args = parser.parse_args() + output = Path(args.output) + if output.exists(): + raise SystemExit("Choose new output path") + name, base = extra_api(pool_size=1) + function = "poolwait_" + uuid4().hex[:8] + trigger_created = False + try: + with httpx.Client( + base_url=base, trust_env=False, timeout=15 + ) as client: + user, _, session = actor(client) + headers = auth(session) + chat = client.post( + "/api/v1/chats", + headers=headers, + json={"title": "Pool test", "member_ids": [user["id"]]}, + ).json() + path = "/api/v1/chats/" + chat["id"] + "/messages" + sql( + "CREATE FUNCTION " + + function + + "() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF NEW.chat_id='" + + chat["id"] + + "'::uuid THEN PERFORM pg_sleep(4); END IF; RETURN NEW; END $$; CREATE TRIGGER " + + function + + " BEFORE INSERT ON messages FOR EACH ROW EXECUTE FUNCTION " + + function + + "()" + ) + trigger_created = True + with ThreadPoolExecutor(max_workers=1) as pool: + blocking = pool.submit( + client.post, + path, + headers=headers, + json={"text": "Synthetic delayed insert"}, + ) + for _ in range(30): + active = sql( + "SELECT count(*) FROM pg_stat_activity WHERE datname=current_database() AND state='active' AND query LIKE 'INSERT INTO messages%'" + ) + if int(active) > 0: + break + time.sleep(0.05) + else: + raise AssertionError("Blocked INSERT not observed") + started = time.perf_counter() + second = client.get("/api/v1/users/me", headers=headers) + waited = time.perf_counter() - started + assert second.status_code == 503 and 0.8 <= waited < 3 + first = blocking.result(timeout=6) + assert first.status_code == 503 + sql( + "DROP TRIGGER " + + function + + " ON messages; DROP FUNCTION " + + function + + "()" + ) + trigger_created = False + assert client.get(path, headers=headers).json()["items"] == [] + assert ( + client.post( + path, headers=headers, json={"text": "After recovery"} + ).status_code + == 201 + ) + result = { + "date": datetime.now(UTC).isoformat(), + "commit": command(["git", "rev-parse", "HEAD"]), + "command": "python -m scripts.verify_pool", + "pool_size": 1, + "blocked_insert_observed_in_pg_stat_activity": True, + "pool_wait_seconds": waited, + "pool_timeout_status": second.status_code, + "statement_timeout_status": first.status_code, + "failed_write_rolled_back": True, + "write_after_recovery": 201, + "result": "PASS", + } + output.parent.mkdir(parents=True, exist_ok=True) + output.write_text( + json.dumps(result, ensure_ascii=False, indent=2) + "\n" + ) + print(json.dumps(result, ensure_ascii=False, indent=2)) + finally: + if trigger_created: + sql( + "DROP TRIGGER IF EXISTS " + + function + + " ON messages; DROP FUNCTION IF EXISTS " + + function + + "()" + ) + command(["docker", "rm", "-f", name]) + + +if __name__ == "__main__": + main()