Affects Version/s: None
Fix Version/s: None
We allow duplicate submissions, and retrieve them with a combination of mbid and offset. We currently compute this offset by ordering all items by submission date, and applying an SQL offset/limit.
This means that every time we get a lowlevel or highlevel item, we have to perform a sort in the query to get the offset, which we believe is using a lot of processing power.
Instead, we want to compute the offset once at submission time, and make all queries that include an offset just select this value. This will also make some queries such as bulk-get much simpler (and will mean that we don't need
We should do this in a few steps:
- Migration to add the field, nullable
- Migration to add the offset for all existing submissions
- Stop submissions, and add offset for all missing items
- Release change that computes offset on submission
- Migration, remove nullable, add index
- Release change that uses offset to select items