Clean up schema for table milestones
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
From https://gitlab.com/gitlab-com/infrastructure/issues/1709 (private to GitLab employees):
- Missing constraint: iid NOT NULL
- Missing constraint: state NOT NULL
- Extra default: Specifying "default NULL" isn't necessary- NULL is the default when there is no default
- Missing FK: project_id -> projects (40 entries violate this rule)
- Extra index: btree index on title- is it actually useful?
- If MySQL doesn't use it we can get rid of this since we use trigram/GIN indexes for searching.
- Duplicate data: state would be more efficient as an enum or integer (or smaller), save 649 kB
- Extra index: due_date index does not look very used, perhaps not necessary?
- Probably because milestone due dates are not commonly used on GitLab.com, meaning we still need to keep the index for self hosted indexes.
- First figure out how frequently these are used, then see if removing them slows things down or not
- due_date is frequently NULL, do NULLs need to be in the index? Perhaps use partial index
- NULLs should not be indexed since you can not filter by due_date with NULL values.
Edited by 🤖 GitLab Bot 🤖