Opened 20 months ago
Closed 11 months ago
#34534 closed Cleanup/optimization (fixed)
Reduce index/constraints operations.
Reported by: | David Sanders | Owned by: | bcail |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | bcail | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
From https://github.com/django/django/pull/16819#issuecomment-1529913703
RenameIndex
can be reduced intoAddIndex
DropConstraint
can be reduced withAddConstraint
- A question was raised whether constraints could be reduced into create model though some databases do not support deferrable constraints (eg MySQL)
- It's worth going over the operations to see if there are any other potential reductions to add
Change History (19)
comment:1 by , 20 months ago
Component: | Database layer (models, ORM) → Migrations |
---|---|
Easy pickings: | unset |
Summary: | Migration operation optimisations → Reduce index/constraints operations. |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 20 months ago
Description: | modified (diff) |
---|
comment:3 by , 20 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 20 months ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
comment:7 by , 20 months ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
comment:9 by , 20 months ago
Has patch: | unset |
---|---|
Triage Stage: | Ready for checkin → Accepted |
comment:10 by , 19 months ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:11 by , 19 months ago
Thank you for reporting this David, making the PR Akash, and reviewing Mariusz. 👏
I was just looking at a migration with consecutive add + remove operations for the same constraints, wondering why they weren't optimized. Glad to see they will be in the future.
follow-up: 13 comment:12 by , 11 months ago
Cc: | added |
---|
Should this ticket be closed, or is there something else that's supposed to be done here?
comment:13 by , 11 months ago
Replying to bcail:
Should this ticket be closed, or is there something else that's supposed to be done here?
Two points remain unresolved:
- A question was raised whether constraints could be reduced into create model though some databases do not support deferrable constraints (eg MySQL)
- It's worth going over the operations to see if there are any other potential reductions to add
comment:14 by , 11 months ago
A question was raised whether constraints could be reduced into create model though some databases do not support deferrable constraints (eg MySQL)
I opened a PR for this part. Is that on the right track?
comment:15 by , 11 months ago
Has patch: | set |
---|
comment:16 by , 11 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:17 by , 11 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:19 by , 11 months ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Thanks for the ticket.
This point it too generic. Please open a new ticket when you will find something more. We don't want to keep this ticket to be open forever.