-
Couldn't load subscription status.
- Fork 2.3k
improvement(performance): remove unused source/target indices, add index on snapshot id #1603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…dex on snapshot id
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR optimizes database indices for the workflow_edges and workflow_execution_logs tables.
Changes:
- Removes redundant single-column indices
workflow_edges_source_block_idxandworkflow_edges_target_block_idxfrom theworkflow_edgestable. These indices are unnecessary because all queries filter byworkflowIdfirst, making the existing composite indicesworkflow_edges_workflow_source_idx(onworkflowId,sourceBlockId) andworkflow_edges_workflow_target_idx(onworkflowId,targetBlockId) sufficient and more efficient. - Adds
workflow_execution_logs_state_snapshot_id_idxonworkflow_execution_logs.state_snapshot_id. This index optimizes join queries betweenworkflow_execution_logsandworkflow_execution_snapshotstables, which are used in multiple API endpoints to fetch execution state data.
The migration correctly synchronizes the SQL changes with the schema definition.
Confidence Score: 5/5
- This PR is safe to merge with no risk
- The changes are well-justified performance optimizations. The removed indices are redundant because all workflow_edges queries filter by workflowId first, making composite indices more effective. The added stateSnapshotId index directly addresses a real query pattern (joins with workflow_execution_snapshots) found in multiple API routes. The migration is properly structured and synchronized with the schema.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| packages/db/migrations/0098_thick_prima.sql | 5/5 | Drops unused single-column indices on workflow_edges and adds new index on workflow_execution_logs.state_snapshot_id for join queries |
| packages/db/schema.ts | 5/5 | Removes redundant single-column indices from workflowEdges table and adds stateSnapshotIdIdx to workflowExecutionLogs table |
Sequence Diagram
sequenceDiagram
participant API as API Route
participant DB as Database
participant WEL as workflow_execution_logs
participant WES as workflow_execution_snapshots
participant WE as workflow_edges
Note over WE: Before: Had redundant indices<br/>source_block_idx, target_block_idx
Note over WE: After: Only composite indices<br/>workflow_source_idx, workflow_target_idx
API->>DB: Query workflow edges
DB->>WE: SELECT * WHERE workflowId = ?
Note over WE: Uses workflow_id_idx<br/>(composite indices cover<br/>source/target filtering)
WE-->>DB: Return edges
DB-->>API: Edges data
API->>DB: Query execution logs with state
DB->>WEL: SELECT * WHERE executionId = ?
WEL-->>DB: Return log with stateSnapshotId
Note over WEL: New index added:<br/>state_snapshot_id_idx
DB->>WES: SELECT * WHERE id = stateSnapshotId
Note over WES: Join optimized by new index
WES-->>DB: Return snapshot data
DB-->>API: Complete execution data
4 files reviewed, no comments
|
Wow perfect
sub, 11. lis 2025. 20:29 Waleed ***@***.***> je napisao:
… Merged #1603 <#1603> into staging.
—
Reply to this email directly, view it on GitHub
<#1603 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BU4CU7J3H3T2WRRX5TGJQYL3XFD7BAVCNFSM6AAAAACI5TKOTCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRQGIZDMNJZG44TCOI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
…dex on snapshot id (#1603)
…dex on snapshot id (#1603)
* improvement(performance): remove unused source/target indices, add index on snapshot id (#1603) * fix(blog): rename building to blogs with redirect (#1604) * improvement(privacy-policy): updated privacy policy for google (#1602) * updated privacy policy for google * update terms, privacy, and emails to incl address and update verbiage * feat(guardrails): added guardrails block/tools and docs (#1605) * Adding guardrails block * ack PR comments * cleanup checkbox in dark mode * cleanup * fix supabase tools * fix(inference-billing): fix inference billing when stream is true via API, add drag-and-drop functionality to deployed chat (#1606) * fix(inference): fix inference billing when stream is true via API * add drag-and-drop to deployed chat * feat(mistal): added mistral as a provider, updated model prices (#1607) * feat(mistal): added mistral as a provider, updated model prices * remove the ability for a block to reference its own outluts * fixed order of responses for guardrails block * feat(versions): added the ability to rename deployment versions (#1610) * fix(vulns): fix various vulnerabilities and enhanced code security (#1611) * fix(vulns): fix SSRF vulnerabilities * cleanup * cleanup * regen docs * remove unused deps * fix failing tests * cleanup * update deps * regen bun lock
Summary
Type of Change
Testing
Tested manually/
Checklist