incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <j...@couchbase.com>
Subject Re: CouchDB document design for facebook insights
Date Fri, 07 Dec 2012 18:51:54 GMT

On Dec 7, 2012, at 12:32 AM, Dmitriy Fot <dmitriy.fot@gmail.com<mailto:dmitriy.fot@gmail.com>>
wrote:

- Is it right decision to use an array for the timestamp, or it is
better to use a long?

Depends what you’ll be using it for. The array you have is great if you’ll be doing a
lot of tests based on the components of the date, i.e. all the posts from November 2012. If
you just need to compare times or look at the interval between two times, a numeric timestamp
is best (at the expense of not being directly human-readable.) A string timestamp is more
compact than an array and can be converted into either a number or components by the JS Date
class, although the conversion is somewhat expensive.

(Another thing to consider about timestamps is whether you need to remember the time zone
or not. For most purposes you can just pre-convert everything to UTC, but for some queries
you might want to know the local time, i.e. “what time of day do people post most often?”)

—Jens

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message