Consider increasing default gap in RelativePositioning

In https://gitlab.com/gitlab-org/gitlab-ce/issues/64514 we see a performance issue due to relative positions being close together.

We are fixing the performance issue in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/30938 but I think it is also worth considering increasing the gap size to prevent needing to update multiple rows.

In RelativePositioning we currently have:

MIN_POSITION = 0
START_POSITION = Gitlab::Database::MAX_INT_VALUE / 2
MAX_POSITION = Gitlab::Database::MAX_INT_VALUE
IDEAL_DISTANCE = 500
  1. I think we should set MIN_POSITION to include the negative integer space, otherwise that's just a waste.
  2. We should also consider using BIGINT here so that we have a larger space to work with.
  3. Then we can increase the IDEAL_DISTANCE so that close sequences are less likely to occur.

cc @smcgivern

Assignee Loading
Time tracking Loading