{ "messages_in_chat": 10000, "limit_plus_one": 51, "index": "messages_history_idx (chat_id, created_at, id)", "first_sql": "SELECT id,chat_id,sender_id,text,created_at FROM messages WHERE chat_id=$1 ORDER BY created_at,id LIMIT 51", "deep_sql": "SELECT id,chat_id,sender_id,text,created_at FROM messages WHERE chat_id=$1 AND (created_at,id)>($2,$3) ORDER BY created_at,id LIMIT 51", "first": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.29, "Total Cost": 4.28, "Plan Rows": 51, "Plan Width": 78, "Actual Startup Time": 0.003, "Actual Total Time": 0.007, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 3, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Index Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Scan Direction": "Forward", "Index Name": "messages_history_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.29, "Total Cost": 782.85, "Plan Rows": 10000, "Plan Width": 78, "Actual Startup Time": 0.002, "Actual Total Time": 0.005, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "(chat_id = 'f8c5bb0f-69c2-4915-a42b-0ce8e1192fb0'::uuid)", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 3, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 6, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.016, "Triggers": [], "Execution Time": 0.011 }, "deep_after_9001": { "Plan": { "Node Type": "Limit", "Parallel Aware": false, "Async Capable": false, "Startup Cost": 0.29, "Total Cost": 15.31, "Plan Rows": 51, "Plan Width": 78, "Actual Startup Time": 0.003, "Actual Total Time": 0.007, "Actual Rows": 51, "Actual Loops": 1, "Shared Hit Blocks": 3, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0, "Plans": [ { "Node Type": "Index Scan", "Parent Relationship": "Outer", "Parallel Aware": false, "Async Capable": false, "Scan Direction": "Forward", "Index Name": "messages_history_idx", "Relation Name": "messages", "Alias": "messages", "Startup Cost": 0.29, "Total Cost": 296.45, "Plan Rows": 1005, "Plan Width": 78, "Actual Startup Time": 0.003, "Actual Total Time": 0.005, "Actual Rows": 51, "Actual Loops": 1, "Index Cond": "((chat_id = 'f8c5bb0f-69c2-4915-a42b-0ce8e1192fb0'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:09.001+00'::timestamp with time zone, 'eba8d96b-593c-4bb1-b6b6-b8f8787d228d'::uuid)))", "Rows Removed by Index Recheck": 0, "Shared Hit Blocks": 3, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 } ] }, "Planning": { "Shared Hit Blocks": 0, "Shared Read Blocks": 0, "Shared Dirtied Blocks": 0, "Shared Written Blocks": 0, "Local Hit Blocks": 0, "Local Read Blocks": 0, "Local Dirtied Blocks": 0, "Local Written Blocks": 0, "Temp Read Blocks": 0, "Temp Written Blocks": 0 }, "Planning Time": 0.019, "Triggers": [], "Execution Time": 0.014 } }