What's the benefit to using a dateTime @index(hour) vs a string @index(exact)

(Erik Miller) #1

From a performance perspective which is better at sorting and what dateTime functionality is lost by not using dateTime as the type.

(Daniel Mai) #2

If you treat datetime values as strings then you can only do lexicographical sorting. With the date time indices you can do finer-detailed sorting based on year, month, day, and/or hour (with @index(hour), you generate all four indices).

As mentioned in the datetime indices docs, it depends on your use case which type of index you choose to use.