{ "hypothesis": "Keyset pagination on (chat_id, created_at, id) avoids large offsets; redundant (chat_id)-only index does not improve reads but slows writes.", "hot_chat_id": "01aeb3d4-8235-4964-8981-ace0cec560df", "read_plans": { "keyset_limit_50": { "node_type": "Index Only Scan", "index_name": "messages_chat_history_idx", "execution_ms": 0.349, "plan_rows": 11 }, "offset_50000_limit_50": { "node_type": "Index Only Scan", "index_name": "messages_chat_history_idx", "execution_ms": 7.043, "plan_rows": 1 }, "keyset_with_extra_chat_id_index": { "node_type": "Index Scan", "index_name": "messages_chat_id_only_idx", "execution_ms": 9.797, "plan_rows": 11 } }, "write_messages_per_second": { "with_extra_chat_id_index": 18199.5, "production_indexes_only": 20166.9 } }