To clarify, I’m using one of these NoSQL databases whose idea of sorting is limited to lexicographic sort (i.e., stringy sort: leveldb, CouchDB). I use ISO-formatted timestamps—“2017-07-03T17:48:12.857Z”—as part of the stringy key to get temporal sorting, but naturally this will break in the year 10k of the Common Era, since `10000-01-01T…` sorts before `9999-12-12T…` (or `2017-07-03T…` for that matter).
Lexicographic sorting, ladies and gents…
@22 Now you just have to make sure someone actually implements that in the relevant software within the next few thousand years, and you're good. :-) (I'm leaving an additional several thousand years for proper deployment and integration testing, of course…)
Thanks to @dasyatidprime’s pointer to https://tools.ietf.org/html/rfc2550 (section 3) the solution has already been described. Year 10K will be stringified as A10000. Year 100K as "B100000". And so on.
Problem solved. Moving on. Nothing more left to see.