Create indexes based on EPOCH time or ISO-8601

n1ql
server

#1

What is the most efficient/recommended date/time format to use for indexing and querying? I am aware that you can use the date functions to convert epoch time to ISO dates in N1QL queries, but what is the most efficient/ideal format?


#2

Based on what you want to do, what operations you are doing. For example: ISO-8601 can include TZ also and it is string comparable. You can aggregation by year or year-month, year-mothn-day, … just using SUBSTR() or date functions.
epoch time also converted to ISO-8601 If you are doing every document in query it might be overhead.


#3

Which one might be overhead? Storing as epoch time and converting each document’s time value to ISO-8601 during queries using MILLIS_TO_STR?


#4

epoch time 8 bytes vs ISO-8601 29 bytes,
conversion vs Disk i/0, network transfer
no-timezone vs timezone