I want to index some documents by a date field, but I’m alway interested in reading the data most recent first. I know I can provide a descending flag, but was wondering if it would be better to store them in the order I want to read them - most recent first. If so, what’s a good technique?
Descending queries are just as efficient as ascending, so I wouldn’t worry about it.
(You could certainly come up with an encoding that would cause dates to sort in the reverse order — for example, just substitute every digit d
with 9-d
— but it would take more work when indexing and querying, and make debugging harder since the view keys would be unreadable.)
Ah thanks. I thought I’d read that there was a performance boost.