Add three btree indexes that back the server-side available-quantity#627
Open
EdwinBetanc0urt wants to merge 2 commits into
Open
Conversation
re-validation added to `OutBoundOrderLogic.generateLoadOrder` as part of
the fix for duplicate outbound
orders from the same sales order.
## Indexes
- `idx_wm_inoutboundline_c_orderline_id` on `WM_InOutBoundLine (C_OrderLine_ID)`
- `idx_wm_inoutboundline_dd_orderline_id` on `WM_InOutBoundLine (DD_OrderLine_ID)`
- `idx_m_inoutline_wm_inoutboundline_id` on `M_InOutLine (WM_InOutBoundLine_ID)`
Names match the canonical FK-index convention already present in most
instances (verified in dyd-dev), so the migration is a no-op there.
## Idempotency
All three steps use `CREATE INDEX IF NOT EXISTS` and provide
`DROP INDEX IF EXISTS` as `RollbackStatement`. Safe to re-run.
## Measured impact (dyd-dev: 61k wm_inoutboundline, 285k m_inoutline)
- With these indexes: 0.43 ms / line (~17 ms for a 41-line generation)
- Without them: ~80 ms / line (~3.3 s for 41 lines)
## Test plan
- [ ] Migration runs green against a clean instance (indexes created).
- [ ] Migration runs green against an instance that already has them
(no-op via `IF NOT EXISTS`).
- [ ] `pg_indexes` shows the three indexes on the expected columns.
- [ ] Rollback drops them cleanly.
## Notes
`CONCURRENTLY` is intentionally omitted because migration steps run
inside a transaction. On very large production databases, DBAs can
pre-create the indexes with `CREATE INDEX CONCURRENTLY` before running
the migration — the `IF NOT EXISTS` will then make this step a no-op.
Same rationale documented in the sibling migration #503650.
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.
re-validation added to
OutBoundOrderLogic.generateLoadOrderas part of the fix for duplicate outboundorders from the same sales order.
Indexes
idx_wm_inoutboundline_c_orderline_idonWM_InOutBoundLine (C_OrderLine_ID)idx_wm_inoutboundline_dd_orderline_idonWM_InOutBoundLine (DD_OrderLine_ID)idx_m_inoutline_wm_inoutboundline_idonM_InOutLine (WM_InOutBoundLine_ID)Names match the canonical FK-index convention already present in most instances (verified in dyd-dev), so the migration is a no-op there.
Idempotency
All three steps use
CREATE INDEX IF NOT EXISTSand provideDROP INDEX IF EXISTSasRollbackStatement. Safe to re-run.Measured impact (dyd-dev: 61k wm_inoutboundline, 285k m_inoutline)
Test plan
IF NOT EXISTS).pg_indexesshows the three indexes on the expected columns.Notes
CONCURRENTLYis intentionally omitted because migration steps run inside a transaction. On very large production databases, DBAs can pre-create the indexes withCREATE INDEX CONCURRENTLYbefore running the migration — theIF NOT EXISTSwill then make this step a no-op. Same rationale documented in the sibling migration503650.