Optimize Indexes#656
Merged
Merged
Conversation
qianl15
reviewed
May 1, 2026
qianl15
reviewed
May 1, 2026
qianl15
approved these changes
May 4, 2026
kraftp
added a commit
to dbos-inc/dbos-transact-ts
that referenced
this pull request
May 4, 2026
Analogous to dbos-inc/dbos-transact-py#656
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimize
workflow_statustable indexes to reduce the cost of maintaining indexes at scale.parent_workflow_id,forked_from, anddeduplication_idare made partial on those fields not being NULL so they're not maintained when not needed.executor_idis dropped as use in memory map to enforce worker concurrency #644 eliminates the need for it.statusfield is split into two partial indexes: one onPENDINGworkflows for use in recovery; the other on failed workflows (ERROR,CANCELLED,MAX_RECOVERY_ATTEMPTS_EXCEEDED) for rapid troubleshooting. This reduces the number of times the index is updated during a typical workflow lifetime (ENQUEUED->PENDING->SUCCESS).queue_nameandstatusused by the main dequeue query is optimized to index on("queue_name", "status", "priority", "created_at"), the exact predicates and sort order of the dequeue query. It is now partial onENQUEUEDorPENDINGworkflows as only the dequeue query needs it.rate_limitedfield).CREATE INDEX CONCURRENTLYfor safety when running against production workloads.