fix(ddl): index result_snapshot.notebook_id and execution.notebook_id #23

Merged
KofTwentyTwo merged 1 commits from feature/schema-notebook-indexes into develop 2026-10-14 22:36:42 +00:00
KofTwentyTwo commented 2026-10-14 20:28:26 +00:00 (Migrated from github.com)

What

docs/ddl/postgres.sql and the H2 test schema get two indexes:

  • ix_sql_workbench_result_snapshot_notebook on sql_workbench_result_snapshot (notebook_id). This column is the foreign key to the notebook, and it had no index. It is used by:
    • NotebookService byNotebook (snapshot list)
    • the notebook delete cascade (NotebookTableCustomizer, notebookId IN ids)
    • the snapshot join and child record lock
  • ix_sql_workbench_execution_notebook on sql_workbench_execution (notebook_id). The notebook page's "Runs" list (JOIN_NOTEBOOK_EXECUTION) joins on it.

Tests

  • PostgresIntegrationTest.testShippedDdlIndexesNotebookChildColumns applies the shipped DDL, then fails if any sql_workbench_ foreign-key column has no leading index. It also checks for the execution index. It fails without this change, reporting sql_workbench_result_snapshot.notebook_id.
  • ./mvnw verify is green locally, including Testcontainers.

kof22 applies the same two indexes, by the same names, in its own changeset.

🤖 Generated with Claude Code

## What `docs/ddl/postgres.sql` and the H2 test schema get two indexes: - `ix_sql_workbench_result_snapshot_notebook` on `sql_workbench_result_snapshot (notebook_id)`. This column is the foreign key to the notebook, and it had no index. It is used by: - `NotebookService` `byNotebook` (snapshot list) - the notebook delete cascade (`NotebookTableCustomizer`, `notebookId IN ids`) - the snapshot join and child record lock - `ix_sql_workbench_execution_notebook` on `sql_workbench_execution (notebook_id)`. The notebook page's "Runs" list (`JOIN_NOTEBOOK_EXECUTION`) joins on it. ## Tests - `PostgresIntegrationTest.testShippedDdlIndexesNotebookChildColumns` applies the shipped DDL, then fails if any `sql_workbench_` foreign-key column has no leading index. It also checks for the execution index. It fails without this change, reporting `sql_workbench_result_snapshot.notebook_id`. - `./mvnw verify` is green locally, including Testcontainers. kof22 applies the same two indexes, by the same names, in its own changeset. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.