your description makes the distinction between the (unsorted) data base and a variant where identifiers have been sorted. So it sounds like you have two sub-problems that you should specify: sorting the data base and then retrieving a batch of elements. For the second part, you should find it easy to extract a batch of given size from a *sequence* (rather than a *set*) of elements. I do not know whether you intend sorting to be part of the regular operation of the system or just an auxiliary function used in the specification of this particular problem.
Hope this helps,