citusdata / postgresql-hll

PostgreSQL extension adding HyperLogLog data structures as a native data type
http://blog.aggregateknowledge.com/2013/02/04/open-source-release-postgresql-hll/
Apache License 2.0
1.13k stars 116 forks source link

Implement hll_hash_date #21

Open jberkus opened 10 years ago

jberkus commented 10 years ago

While hll_hash_timestamptz wouldn't be terribly useful, hll_hash_date certainly could be. And it shouldn't be hard to implement; you can transform a date to an INT. However, since the range of INTs for a valid date would be different from 0-MAXINT, should we adjust the hash function somehow?

ghost commented 10 years ago

As long as you can get it to an integer, it should be safe to hash. Consecutive ranges of the integer space should not have worse hashing properties than a random subset of the space.