ON DELETE SET NULL foreign keys. Deleting a conversation or turn scans the run table without them.
The other FK columns with no index (model, profile and provider references on config-sized tables) are never filtered or joined in code, so this leaves them out on purpose.
Why
This came out of an index audit of the qbits installed on kof22. The qbit ships no Liquibase changelog; hosts own the DDL, and kof22 applies the same six indexes, by the same names, in its own changeset.
## What
The reference DDL `docs/schema-postgres.sql` gets an "Index audit" block with six indexes, all `IF NOT EXISTS`. `UPGRADE.md` gets a matching note.
| Index | Why |
|---|---|
| `assistant_usage_turn` (turn_id) | `ScheduledTurn.cost` reads usage by turn on every scheduled run. `assistant_usage` gains a row per model call and is the fastest-growing table. |
| `assistant_turn_event_create_date` | `AssistantStore.deleteTurnEventsBefore` (retention) |
| `assistant_tool_call_create_date` | `AssistantStore.clearToolResultsBefore` (retention) |
| `assistant_conversation_modify_date` | `AssistantStore.listConversationsInactiveSince` (retention) |
| `assistant_scheduled_run_conversation`, `assistant_scheduled_run_turn` | `ON DELETE SET NULL` foreign keys. Deleting a conversation or turn scans the run table without them. |
The other FK columns with no index (model, profile and provider references on config-sized tables) are never filtered or joined in code, so this leaves them out on purpose.
## Why
This came out of an index audit of the qbits installed on kof22. The qbit ships no Liquibase changelog; hosts own the DDL, and kof22 applies the same six indexes, by the same names, in its own changeset.
No code change, so no tests are affected.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
The reference DDL
docs/schema-postgres.sqlgets an "Index audit" block with six indexes, allIF NOT EXISTS.UPGRADE.mdgets a matching note.assistant_usage_turn(turn_id)ScheduledTurn.costreads usage by turn on every scheduled run.assistant_usagegains a row per model call and is the fastest-growing table.assistant_turn_event_create_dateAssistantStore.deleteTurnEventsBefore(retention)assistant_tool_call_create_dateAssistantStore.clearToolResultsBefore(retention)assistant_conversation_modify_dateAssistantStore.listConversationsInactiveSince(retention)assistant_scheduled_run_conversation,assistant_scheduled_run_turnON DELETE SET NULLforeign keys. Deleting a conversation or turn scans the run table without them.The other FK columns with no index (model, profile and provider references on config-sized tables) are never filtered or joined in code, so this leaves them out on purpose.
Why
This came out of an index audit of the qbits installed on kof22. The qbit ships no Liquibase changelog; hosts own the DDL, and kof22 applies the same six indexes, by the same names, in its own changeset.
No code change, so no tests are affected.
🤖 Generated with Claude Code