{ "recorded_at": "2026-10-12T08:45:43.120Z", "command": "node scripts/explain-history.mjs", "node_version": "v24.20.0", "docker": { "cpus": 4, "memory_bytes": 3008614400, "server_version": "28.3.2", "os": "Docker Desktop", "arch": "x86_64", "postgres_container": { "image": "postgres:17.6-bookworm", "memory_limit_bytes": 0, "nano_cpus": 0, "cpu_quota": 0, "cpu_period": 0, "cpuset_cpus": "" } }, "settings": [ { "name": "block_size", "setting": "8192", "unit": null }, { "name": "effective_cache_size", "setting": "524288", "unit": "8kB" }, { "name": "jit", "setting": "on", "unit": null }, { "name": "max_parallel_workers_per_gather", "setting": "2", "unit": null }, { "name": "random_page_cost", "setting": "4", "unit": null }, { "name": "server_version", "setting": "17.6 (Debian 17.6-2.pgdg12+1)", "unit": null }, { "name": "shared_buffers", "setting": "16384", "unit": "8kB" }, { "name": "work_mem", "setting": "4096", "unit": "kB" } ], "source_table_indexes_before": [ { "indexname": "messages_chat_id_created_at_id_idx", "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON public.messages USING btree (chat_id, created_at, id)" }, { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON public.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON public.messages USING btree (sender_id)" } ], "dataset": { "total_messages": 60000, "target_chat_messages": 20000, "chats": 5, "distribution": [ { "chat_id": "fb372790-4b73-5a45-c97c-7e4287fa05be", "messages": 20000 }, { "chat_id": "096d532a-b923-0f13-8dc9-243f47b54ac3", "messages": 10000 }, { "chat_id": "118c4ce4-f95c-c2a2-0ecf-f2aeb0cc0b49", "messages": 10000 }, { "chat_id": "35bbad77-7634-ca61-4fd8-5d37539c23b8", "messages": 10000 }, { "chat_id": "a3c16613-13f1-93e3-af30-521782e6eb21", "messages": 10000 } ], "text_length": 256, "timestamp_ties": 10, "insertion_order": "interleaved chats" }, "method": { "warmup_runs_per_query_per_phase": 1, "measured_runs": 5, "page_size": 50, "fetched_rows": 51, "cursor_positions": [ 10000, 18000 ], "cache": "warm PostgreSQL buffers; Redis is bypassed", "cleanup": "ROLLBACK the experiment schema; live tables and indexes unchanged", "planner": "default scan settings; no forced index or disabled sequential scans", "schema_difference": "copied columns/checks/defaults; foreign keys omitted equally in all phases", "tuple_variant": "proposed equivalent SQL, not currently used by Prisma listMessages" }, "source_table_indexes_after": [ { "indexname": "messages_chat_id_created_at_id_idx", "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON public.messages USING btree (chat_id, created_at, id)" }, { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON public.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON public.messages USING btree (sender_id)" } ], "experiment_schema_absent": true, "cleanup_completed": true, "runs": [ { "phase": "no_indexes", "query": "first_page", "indexes": [], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", 51 ], "result_sha256": "138ed492cb091c27b09f072b1658e219e66907e30679526b9b475db438b40c6a", "execution_ms": [ 24.433, 23.558, 35.517, 28.718, 43.21 ], "median_execution_ms": 28.718, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4027.78, "Total Cost": 4027.9, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 28.676, "Actual Total Time": 28.686, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 4027.78, "Total Cost": 4077.89, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 28.675, "Actual Total Time": 28.679, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 0.014, "Actual Total Time": 19.873, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.076, "Triggers": [], "Execution Time": 28.718 }, "scan_type": "Seq Scan", "index_name": null, "rows_removed_by_filter": 40000, "scanned_rows": 60000, "sort": true, "shared_buffer_hits": 2609, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4027.78, "Total Cost": 4027.9, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 24.389, "Actual Total Time": 24.401, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 4027.78, "Total Cost": 4077.89, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 24.388, "Actual Total Time": 24.393, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 0.013, "Actual Total Time": 17.477, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.131, "Triggers": [], "Execution Time": 24.433 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4027.78, "Total Cost": 4027.9, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 23.516, "Actual Total Time": 23.529, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 4027.78, "Total Cost": 4077.89, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 23.515, "Actual Total Time": 23.521, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 0.016, "Actual Total Time": 17.133, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.073, "Triggers": [], "Execution Time": 23.558 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4027.78, "Total Cost": 4027.9, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 35.472, "Actual Total Time": 35.483, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 4027.78, "Total Cost": 4077.89, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 35.471, "Actual Total Time": 35.476, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 0.019, "Actual Total Time": 27.687, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.093, "Triggers": [], "Execution Time": 35.517 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4027.78, "Total Cost": 4027.9, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 28.676, "Actual Total Time": 28.686, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 4027.78, "Total Cost": 4077.89, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 28.675, "Actual Total Time": 28.679, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 0.014, "Actual Total Time": 19.873, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.076, "Triggers": [], "Execution Time": 28.718 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4027.78, "Total Cost": 4027.9, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 43.07, "Actual Total Time": 43.179, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 4027.78, "Total Cost": 4077.89, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 43.069, "Actual Total Time": 43.074, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 20046, "Plan Width": 316, "Actual Startup Time": 0.019, "Actual Total Time": 24.581, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.114, "Triggers": [], "Execution Time": 43.21 } ] }, { "phase": "no_indexes", "query": "middle_page_or", "indexes": [], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", "2026-01-01T00:16:39.000Z", "f47542f1-8089-6114-80cd-9f75fcae23e0", 51 ], "result_sha256": "0e8cef00f3d683111579ca25950a3f21ecd8225ae703020f0ba49b5303ce0921", "execution_ms": [ 20.653, 50.299, 20.652, 23.885, 21.733 ], "median_execution_ms": 21.733, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.4, "Total Cost": 3922.53, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 21.694, "Actual Total Time": 21.702, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.4, "Total Cost": 3930.9, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 21.692, "Actual Total Time": 21.696, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 9.327, "Actual Total Time": 18.539, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.12, "Triggers": [], "Execution Time": 21.733 }, "scan_type": "Seq Scan", "index_name": null, "rows_removed_by_filter": 50000, "scanned_rows": 60000, "sort": true, "shared_buffer_hits": 2609, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.4, "Total Cost": 3922.53, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 20.554, "Actual Total Time": 20.609, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.4, "Total Cost": 3930.9, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 20.552, "Actual Total Time": 20.587, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 9.678, "Actual Total Time": 17.635, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.872, "Triggers": [], "Execution Time": 20.653 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.4, "Total Cost": 3922.53, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 50.245, "Actual Total Time": 50.257, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.4, "Total Cost": 3930.9, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 50.244, "Actual Total Time": 50.25, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 15.516, "Actual Total Time": 23.855, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.302, "Triggers": [], "Execution Time": 50.299 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.4, "Total Cost": 3922.53, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 20.613, "Actual Total Time": 20.621, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.4, "Total Cost": 3930.9, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 20.612, "Actual Total Time": 20.616, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 7.28, "Actual Total Time": 16.101, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.326, "Triggers": [], "Execution Time": 20.652 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.4, "Total Cost": 3922.53, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 23.845, "Actual Total Time": 23.854, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.4, "Total Cost": 3930.9, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 23.844, "Actual Total Time": 23.848, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 12.075, "Actual Total Time": 20.032, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.095, "Triggers": [], "Execution Time": 23.885 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.4, "Total Cost": 3922.53, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 21.694, "Actual Total Time": 21.702, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.4, "Total Cost": 3930.9, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 21.692, "Actual Total Time": 21.696, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3399, "Plan Width": 316, "Actual Startup Time": 9.327, "Actual Total Time": 18.539, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.12, "Triggers": [], "Execution Time": 21.733 } ] }, { "phase": "no_indexes", "query": "late_page_or", "indexes": [], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", "2026-01-01T00:29:59.000Z", "fd35e333-189b-af5a-fdcf-c376bd20e02b", 51 ], "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", "execution_ms": [ 17.752, 25.704, 10.384, 22.61, 16.779 ], "median_execution_ms": 17.752, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.45, "Total Cost": 3831.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 17.702, "Actual Total Time": 17.715, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.45, "Total Cost": 3833.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 17.7, "Actual Total Time": 17.706, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 16.019, "Actual Total Time": 17.183, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.316, "Triggers": [], "Execution Time": 17.752 }, "scan_type": "Seq Scan", "index_name": null, "rows_removed_by_filter": 58000, "scanned_rows": 60000, "sort": true, "shared_buffer_hits": 2609, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.45, "Total Cost": 3831.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 17.702, "Actual Total Time": 17.715, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.45, "Total Cost": 3833.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 17.7, "Actual Total Time": 17.706, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 16.019, "Actual Total Time": 17.183, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.316, "Triggers": [], "Execution Time": 17.752 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.45, "Total Cost": 3831.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 25.662, "Actual Total Time": 25.671, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.45, "Total Cost": 3833.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 25.66, "Actual Total Time": 25.665, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 23.949, "Actual Total Time": 25.119, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.101, "Triggers": [], "Execution Time": 25.704 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.45, "Total Cost": 3831.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 10.347, "Actual Total Time": 10.357, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.45, "Total Cost": 3833.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 10.345, "Actual Total Time": 10.35, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 8.703, "Actual Total Time": 9.72, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.093, "Triggers": [], "Execution Time": 10.384 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.45, "Total Cost": 3831.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 22.558, "Actual Total Time": 22.576, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.45, "Total Cost": 3833.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 22.557, "Actual Total Time": 22.565, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 19.407, "Actual Total Time": 21.905, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.104, "Triggers": [], "Execution Time": 22.61 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.45, "Total Cost": 3831.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 16.741, "Actual Total Time": 16.75, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.45, "Total Cost": 3833.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 16.739, "Actual Total Time": 16.744, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 9.807, "Actual Total Time": 15.753, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.181, "Triggers": [], "Execution Time": 16.779 } ] }, { "phase": "no_indexes", "query": "late_page_tuple", "indexes": [], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid)\nORDER BY created_at ASC, id ASC LIMIT $4", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", "2026-01-01T00:29:59.000Z", "fd35e333-189b-af5a-fdcf-c376bd20e02b", 51 ], "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", "execution_ms": [ 12.468, 22.145, 22.897, 22.697, 12.853 ], "median_execution_ms": 22.145, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.45, "Total Cost": 3681.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 22.09, "Actual Total Time": 22.1, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.45, "Total Cost": 3683.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 22.088, "Actual Total Time": 22.092, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 19.54, "Actual Total Time": 21.483, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.106, "Triggers": [], "Execution Time": 22.145 }, "scan_type": "Seq Scan", "index_name": null, "rows_removed_by_filter": 58000, "scanned_rows": 60000, "sort": true, "shared_buffer_hits": 2609, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.45, "Total Cost": 3681.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 12.428, "Actual Total Time": 12.436, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.45, "Total Cost": 3683.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 12.427, "Actual Total Time": 12.43, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 10.752, "Actual Total Time": 11.989, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.102, "Triggers": [], "Execution Time": 12.468 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.45, "Total Cost": 3681.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 22.09, "Actual Total Time": 22.1, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.45, "Total Cost": 3683.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 22.088, "Actual Total Time": 22.092, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 19.54, "Actual Total Time": 21.483, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.106, "Triggers": [], "Execution Time": 22.145 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.45, "Total Cost": 3681.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 22.86, "Actual Total Time": 22.87, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.45, "Total Cost": 3683.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 22.859, "Actual Total Time": 22.863, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 20.021, "Actual Total Time": 22.173, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.084, "Triggers": [], "Execution Time": 22.897 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.45, "Total Cost": 3681.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 22.655, "Actual Total Time": 22.664, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.45, "Total Cost": 3683.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 22.653, "Actual Total Time": 22.657, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 16.697, "Actual Total Time": 21.99, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.096, "Triggers": [], "Execution Time": 22.697 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.45, "Total Cost": 3681.58, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 12.816, "Actual Total Time": 12.824, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.45, "Total Cost": 3683.14, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 12.814, "Actual Total Time": 12.818, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 673, "Plan Width": 316, "Actual Startup Time": 10.546, "Actual Total Time": 11.861, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.072, "Triggers": [], "Execution Time": 12.853 } ] }, { "phase": "without_history_index", "query": "first_page", "indexes": [ { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" } ], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", 51 ], "result_sha256": "138ed492cb091c27b09f072b1658e219e66907e30679526b9b475db438b40c6a", "execution_ms": [ 16.619, 17.94, 13.889, 12.897, 48.033 ], "median_execution_ms": 16.619, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4025.31, "Total Cost": 4025.44, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 16.588, "Actual Total Time": 16.597, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.31, "Total Cost": 4075.24, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 16.587, "Actual Total Time": 16.591, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 0.012, "Actual Total Time": 10.485, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.074, "Triggers": [], "Execution Time": 16.619 }, "scan_type": "Seq Scan", "index_name": null, "rows_removed_by_filter": 40000, "scanned_rows": 60000, "sort": true, "shared_buffer_hits": 2609, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4025.31, "Total Cost": 4025.44, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 16.588, "Actual Total Time": 16.597, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.31, "Total Cost": 4075.24, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 16.587, "Actual Total Time": 16.591, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 0.012, "Actual Total Time": 10.485, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.074, "Triggers": [], "Execution Time": 16.619 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4025.31, "Total Cost": 4025.44, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 17.908, "Actual Total Time": 17.916, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.31, "Total Cost": 4075.24, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 17.906, "Actual Total Time": 17.91, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 0.02, "Actual Total Time": 12.207, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.097, "Triggers": [], "Execution Time": 17.94 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4025.31, "Total Cost": 4025.44, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 13.853, "Actual Total Time": 13.861, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.31, "Total Cost": 4075.24, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 13.851, "Actual Total Time": 13.855, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 0.018, "Actual Total Time": 9.364, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.097, "Triggers": [], "Execution Time": 13.889 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4025.31, "Total Cost": 4025.44, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 12.857, "Actual Total Time": 12.865, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.31, "Total Cost": 4075.24, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 12.856, "Actual Total Time": 12.859, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 0.016, "Actual Total Time": 8.773, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.102, "Triggers": [], "Execution Time": 12.897 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 4025.31, "Total Cost": 4025.44, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 47.967, "Actual Total Time": 47.98, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.31, "Total Cost": 4075.24, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 47.966, "Actual Total Time": 47.971, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 52, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3359, "Plan Rows": 19972, "Plan Width": 316, "Actual Startup Time": 0.015, "Actual Total Time": 32.15, "Actual Rows": 20000, "Actual Loops": 1, "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Filter": 40000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.094, "Triggers": [], "Execution Time": 48.033 } ] }, { "phase": "without_history_index", "query": "middle_page_or", "indexes": [ { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" } ], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", "2026-01-01T00:16:39.000Z", "f47542f1-8089-6114-80cd-9f75fcae23e0", 51 ], "result_sha256": "0e8cef00f3d683111579ca25950a3f21ecd8225ae703020f0ba49b5303ce0921", "execution_ms": [ 13.029, 11.602, 11.838, 9.89, 29.564 ], "median_execution_ms": 11.838, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.2, "Total Cost": 3922.33, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 11.8, "Actual Total Time": 11.808, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.2, "Total Cost": 3930.68, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 11.798, "Actual Total Time": 11.802, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 5.784, "Actual Total Time": 10.064, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.132, "Triggers": [], "Execution Time": 11.838 }, "scan_type": "Seq Scan", "index_name": null, "rows_removed_by_filter": 50000, "scanned_rows": 60000, "sort": true, "shared_buffer_hits": 2609, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.2, "Total Cost": 3922.33, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 12.996, "Actual Total Time": 13.004, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.2, "Total Cost": 3930.68, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 12.994, "Actual Total Time": 12.997, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 5, "Actual Total Time": 10.988, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.113, "Triggers": [], "Execution Time": 13.029 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.2, "Total Cost": 3922.33, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 11.566, "Actual Total Time": 11.576, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.2, "Total Cost": 3930.68, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 11.565, "Actual Total Time": 11.569, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 5.094, "Actual Total Time": 9.765, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.096, "Triggers": [], "Execution Time": 11.602 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.2, "Total Cost": 3922.33, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 11.8, "Actual Total Time": 11.808, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.2, "Total Cost": 3930.68, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 11.798, "Actual Total Time": 11.802, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 5.784, "Actual Total Time": 10.064, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.132, "Triggers": [], "Execution Time": 11.838 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.2, "Total Cost": 3922.33, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 9.861, "Actual Total Time": 9.868, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.2, "Total Cost": 3930.68, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 9.859, "Actual Total Time": 9.862, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 3.325, "Actual Total Time": 8.124, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.142, "Triggers": [], "Execution Time": 9.89 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3922.2, "Total Cost": 3922.33, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 29.522, "Actual Total Time": 29.532, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.2, "Total Cost": 3930.68, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 29.52, "Actual Total Time": 29.524, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 3393, "Plan Width": 316, "Actual Startup Time": 6.796, "Actual Total Time": 21.488, "Actual Rows": 10000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", "Rows Removed by Filter": 50000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.16, "Triggers": [], "Execution Time": 29.564 } ] }, { "phase": "without_history_index", "query": "late_page_or", "indexes": [ { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" } ], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", "2026-01-01T00:29:59.000Z", "fd35e333-189b-af5a-fdcf-c376bd20e02b", 51 ], "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", "execution_ms": [ 10.002, 8.746, 9.652, 9.041, 37.533 ], "median_execution_ms": 9.652, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.75, "Total Cost": 3831.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 9.623, "Actual Total Time": 9.631, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.75, "Total Cost": 3833.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 9.622, "Actual Total Time": 9.625, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 8.477, "Actual Total Time": 9.291, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.12, "Triggers": [], "Execution Time": 9.652 }, "scan_type": "Seq Scan", "index_name": null, "rows_removed_by_filter": 58000, "scanned_rows": 60000, "sort": true, "shared_buffer_hits": 2609, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.75, "Total Cost": 3831.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 9.964, "Actual Total Time": 9.973, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.75, "Total Cost": 3833.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 9.962, "Actual Total Time": 9.966, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 8.659, "Actual Total Time": 9.615, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.166, "Triggers": [], "Execution Time": 10.002 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.75, "Total Cost": 3831.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 8.715, "Actual Total Time": 8.723, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.75, "Total Cost": 3833.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 8.714, "Actual Total Time": 8.718, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 7.159, "Actual Total Time": 8.25, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.126, "Triggers": [], "Execution Time": 8.746 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.75, "Total Cost": 3831.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 9.623, "Actual Total Time": 9.631, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.75, "Total Cost": 3833.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 9.622, "Actual Total Time": 9.625, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 8.477, "Actual Total Time": 9.291, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.12, "Triggers": [], "Execution Time": 9.652 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.75, "Total Cost": 3831.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 8.999, "Actual Total Time": 9.013, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.75, "Total Cost": 3833.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 8.997, "Actual Total Time": 9.003, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 7.133, "Actual Total Time": 8.367, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.123, "Triggers": [], "Execution Time": 9.041 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3831.75, "Total Cost": 3831.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 37.493, "Actual Total Time": 37.503, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3831.75, "Total Cost": 3833.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 37.491, "Actual Total Time": 37.495, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3809, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 27.785, "Actual Total Time": 29.553, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.165, "Triggers": [], "Execution Time": 37.533 } ] }, { "phase": "without_history_index", "query": "late_page_tuple", "indexes": [ { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" } ], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid)\nORDER BY created_at ASC, id ASC LIMIT $4", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", "2026-01-01T00:29:59.000Z", "fd35e333-189b-af5a-fdcf-c376bd20e02b", 51 ], "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", "execution_ms": [ 9.253, 8.872, 9.809, 21.15, 25.266 ], "median_execution_ms": 9.809, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.75, "Total Cost": 3681.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 9.776, "Actual Total Time": 9.784, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.75, "Total Cost": 3683.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 9.774, "Actual Total Time": 9.778, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 8.472, "Actual Total Time": 9.399, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.087, "Triggers": [], "Execution Time": 9.809 }, "scan_type": "Seq Scan", "index_name": null, "rows_removed_by_filter": 58000, "scanned_rows": 60000, "sort": true, "shared_buffer_hits": 2609, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.75, "Total Cost": 3681.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 9.212, "Actual Total Time": 9.22, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.75, "Total Cost": 3683.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 9.21, "Actual Total Time": 9.214, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 7.92, "Actual Total Time": 8.835, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.127, "Triggers": [], "Execution Time": 9.253 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.75, "Total Cost": 3681.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 8.839, "Actual Total Time": 8.848, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.75, "Total Cost": 3683.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 8.838, "Actual Total Time": 8.842, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 7.598, "Actual Total Time": 8.464, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.087, "Triggers": [], "Execution Time": 8.872 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.75, "Total Cost": 3681.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 9.776, "Actual Total Time": 9.784, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.75, "Total Cost": 3683.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 9.774, "Actual Total Time": 9.778, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 8.472, "Actual Total Time": 9.399, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.087, "Triggers": [], "Execution Time": 9.809 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.75, "Total Cost": 3681.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 21.102, "Actual Total Time": 21.116, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.75, "Total Cost": 3683.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 21.1, "Actual Total Time": 21.107, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 19.135, "Actual Total Time": 20.538, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.121, "Triggers": [], "Execution Time": 21.15 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 3681.75, "Total Cost": 3681.88, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 25.22, "Actual Total Time": 25.232, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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": 3681.75, "Total Cost": 3683.46, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 25.218, "Actual Total Time": 25.223, "Actual Rows": 51, "Actual Loops": 1, "Sort Key": [ "created_at", "id" ], "Sort Method": "top-N heapsort", "Sort Space Used": 51, "Sort Space Type": "Memory", "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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, "Total Cost": 3659, "Plan Rows": 682, "Plan Width": 316, "Actual Startup Time": 23.106, "Actual Total Time": 24.62, "Actual Rows": 2000, "Actual Loops": 1, "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 58000, "Shared Hit Blocks": 2609, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.107, "Triggers": [], "Execution Time": 25.266 } ] }, { "phase": "with_history_index", "query": "first_page", "indexes": [ { "indexname": "messages_chat_id_created_at_id_idx", "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (chat_id, created_at, id)" }, { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" } ], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", 51 ], "result_sha256": "138ed492cb091c27b09f072b1658e219e66907e30679526b9b475db438b40c6a", "execution_ms": [ 0.1, 0.089, 0.07, 0.131, 0.094 ], "median_execution_ms": 0.094, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 28.95, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.024, "Actual Total Time": 0.071, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11101.66, "Plan Rows": 19840, "Plan Width": 316, "Actual Startup Time": 0.023, "Actual Total Time": 0.064, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.111, "Triggers": [], "Execution Time": 0.094 }, "scan_type": "Index Scan", "index_name": "messages_chat_id_created_at_id_idx", "rows_removed_by_filter": 0, "scanned_rows": 51, "sort": false, "shared_buffer_hits": 31, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 28.95, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.031, "Actual Total Time": 0.073, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11101.66, "Plan Rows": 19840, "Plan Width": 316, "Actual Startup Time": 0.029, "Actual Total Time": 0.067, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.114, "Triggers": [], "Execution Time": 0.1 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 28.95, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.027, "Actual Total Time": 0.065, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11101.66, "Plan Rows": 19840, "Plan Width": 316, "Actual Startup Time": 0.026, "Actual Total Time": 0.059, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.622, "Triggers": [], "Execution Time": 0.089 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 28.95, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.022, "Actual Total Time": 0.053, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11101.66, "Plan Rows": 19840, "Plan Width": 316, "Actual Startup Time": 0.021, "Actual Total Time": 0.047, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.082, "Triggers": [], "Execution Time": 0.07 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 28.95, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.021, "Actual Total Time": 0.112, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11101.66, "Plan Rows": 19840, "Plan Width": 316, "Actual Startup Time": 0.02, "Actual Total Time": 0.088, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.09, "Triggers": [], "Execution Time": 0.131 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 28.95, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.024, "Actual Total Time": 0.071, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11101.66, "Plan Rows": 19840, "Plan Width": 316, "Actual Startup Time": 0.023, "Actual Total Time": 0.064, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 31, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.111, "Triggers": [], "Execution Time": 0.094 } ] }, { "phase": "with_history_index", "query": "middle_page_or", "indexes": [ { "indexname": "messages_chat_id_created_at_id_idx", "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (chat_id, created_at, id)" }, { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" } ], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", "2026-01-01T00:16:39.000Z", "f47542f1-8089-6114-80cd-9f75fcae23e0", 51 ], "result_sha256": "0e8cef00f3d683111579ca25950a3f21ecd8225ae703020f0ba49b5303ce0921", "execution_ms": [ 4.782, 6.997, 5.595, 5.111, 6.055 ], "median_execution_ms": 5.595, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 172.25, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 5.535, "Actual Total Time": 5.567, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 3339, "Plan Width": 316, "Actual Startup Time": 5.534, "Actual Total Time": 5.559, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", "Rows Removed by Filter": 10000, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.129, "Triggers": [], "Execution Time": 5.595 }, "scan_type": "Index Scan", "index_name": "messages_chat_id_created_at_id_idx", "rows_removed_by_filter": 10000, "scanned_rows": 10051, "sort": false, "shared_buffer_hits": 5203, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 172.25, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 4.712, "Actual Total Time": 4.748, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 3339, "Plan Width": 316, "Actual Startup Time": 4.709, "Actual Total Time": 4.738, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", "Rows Removed by Filter": 10000, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.144, "Triggers": [], "Execution Time": 4.782 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 172.25, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 6.933, "Actual Total Time": 6.968, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 3339, "Plan Width": 316, "Actual Startup Time": 6.931, "Actual Total Time": 6.96, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", "Rows Removed by Filter": 10000, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.139, "Triggers": [], "Execution Time": 6.997 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 172.25, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 5.535, "Actual Total Time": 5.567, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 3339, "Plan Width": 316, "Actual Startup Time": 5.534, "Actual Total Time": 5.559, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", "Rows Removed by Filter": 10000, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.129, "Triggers": [], "Execution Time": 5.595 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 172.25, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 5.059, "Actual Total Time": 5.084, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 3339, "Plan Width": 316, "Actual Startup Time": 5.057, "Actual Total Time": 5.078, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", "Rows Removed by Filter": 10000, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.116, "Triggers": [], "Execution Time": 5.111 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 172.25, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 5.987, "Actual Total Time": 6.026, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 3339, "Plan Width": 316, "Actual Startup Time": 5.985, "Actual Total Time": 6.016, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", "Rows Removed by Filter": 10000, "Shared Hit Blocks": 5203, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.116, "Triggers": [], "Execution Time": 6.055 } ] }, { "phase": "with_history_index", "query": "late_page_or", "indexes": [ { "indexname": "messages_chat_id_created_at_id_idx", "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (chat_id, created_at, id)" }, { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" } ], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", "2026-01-01T00:29:59.000Z", "fd35e333-189b-af5a-fdcf-c376bd20e02b", 51 ], "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", "execution_ms": [ 7.771, 8.029, 12.242, 10.479, 10.829 ], "median_execution_ms": 10.479, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 905.39, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 10.421, "Actual Total Time": 10.452, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 10.419, "Actual Total Time": 10.444, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 18000, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.241, "Triggers": [], "Execution Time": 10.479 }, "scan_type": "Index Scan", "index_name": "messages_chat_id_created_at_id_idx", "rows_removed_by_filter": 18000, "scanned_rows": 18051, "sort": false, "shared_buffer_hits": 9355, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 905.39, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 7.723, "Actual Total Time": 7.748, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 7.722, "Actual Total Time": 7.742, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 18000, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.143, "Triggers": [], "Execution Time": 7.771 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 905.39, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 7.978, "Actual Total Time": 8.004, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 7.977, "Actual Total Time": 7.997, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 18000, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.146, "Triggers": [], "Execution Time": 8.029 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 905.39, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 12.174, "Actual Total Time": 12.2, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 12.172, "Actual Total Time": 12.193, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 18000, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.187, "Triggers": [], "Execution Time": 12.242 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 905.39, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 10.421, "Actual Total Time": 10.452, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 10.419, "Actual Total Time": 10.444, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 18000, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.241, "Triggers": [], "Execution Time": 10.479 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 905.39, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 10.768, "Actual Total Time": 10.798, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 11250.46, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 10.766, "Actual Total Time": 10.79, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", "Rows Removed by Index Recheck": 0, "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Filter": 18000, "Shared Hit Blocks": 9355, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 4, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.214, "Triggers": [], "Execution Time": 10.829 } ] }, { "phase": "with_history_index", "query": "late_page_tuple", "indexes": [ { "indexname": "messages_chat_id_created_at_id_idx", "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (chat_id, created_at, id)" }, { "indexname": "messages_pkey", "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" }, { "indexname": "messages_sender_id_idx", "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" } ], "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid)\nORDER BY created_at ASC, id ASC LIMIT $4", "parameters": [ "fb372790-4b73-5a45-c97c-7e4287fa05be", "2026-01-01T00:29:59.000Z", "fd35e333-189b-af5a-fdcf-c376bd20e02b", 51 ], "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", "execution_ms": [ 0.082, 0.08, 0.165, 0.08, 0.079 ], "median_execution_ms": 0.08, "representative_plan": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 180.32, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.029, "Actual Total Time": 0.058, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 2236.91, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 0.028, "Actual Total Time": 0.051, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.113, "Triggers": [], "Execution Time": 0.08 }, "scan_type": "Index Scan", "index_name": "messages_chat_id_created_at_id_idx", "rows_removed_by_filter": 0, "scanned_rows": 51, "sort": false, "shared_buffer_hits": 29, "shared_buffer_reads": 0, "raw_plans": [ { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 180.32, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.03, "Actual Total Time": 0.058, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 2236.91, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 0.029, "Actual Total Time": 0.052, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.116, "Triggers": [], "Execution Time": 0.082 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 180.32, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.029, "Actual Total Time": 0.058, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 2236.91, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 0.028, "Actual Total Time": 0.051, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.113, "Triggers": [], "Execution Time": 0.08 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 180.32, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.041, "Actual Total Time": 0.091, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 2236.91, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 0.039, "Actual Total Time": 0.073, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.166, "Triggers": [], "Execution Time": 0.165 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 180.32, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.029, "Actual Total Time": 0.057, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 2236.91, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 0.028, "Actual Total Time": 0.051, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.168, "Triggers": [], "Execution Time": 0.08 }, { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.41, "Total Cost": 180.32, "Plan Rows": 51, "Plan Width": 316, "Actual Startup Time": 0.029, "Actual Total Time": 0.057, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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_id_created_at_id_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.41, "Total Cost": 2236.91, "Plan Rows": 634, "Plan Width": 316, "Actual Startup Time": 0.028, "Actual Total Time": 0.051, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 29, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "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.108, "Triggers": [], "Execution Time": 0.079 } ] } ] }