{ "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.061, "plan_rows": 50 }, "offset_50000_limit_50": { "node_type": "Index Only Scan", "index_name": "messages_chat_history_idx", "execution_ms": 6.117, "plan_rows": 50 }, "keyset_with_extra_chat_id_index": { "node_type": "Index Only Scan", "index_name": "messages_chat_history_idx", "execution_ms": 0.052, "plan_rows": 50 } }, "write_messages_per_second": { "with_extra_chat_id_index": 23192.1, "production_indexes_only": 38756.3 } }