Hi,
Sorry for my ignorance, if this is common knowledge: What is the use case for sorting millions of different measures from different objects?
The only use case i can think of where the sorting would be necessary is lists like "cities in France by size" or "list of cars by fuel/per 100km". Those list do not have millions of entries, and even there you would need some further logic, since the size is not just one single value, there could be multiple values for the size (or fuel consumption) with different sources and for different times. For cars there could be entries by the manufacturer, by some car-testing magazine, etc. I don't see how this could be adequatly represented/sorted by a database only query.
If however this is necessary, i still don't understand why it must affect the datavalue structure. If a index is necessary it could be done over a serialized representation of the value. This needs to be done anyway, since the values are saved at a specific unit (which is just a wikidata item). To compare them on a database level they must all be saved at the same unit, or some sort of procedure must be used to compare them (or am i missing something again?).
Friedrich