Skip to main content

HASH function as a Uniqe number generator

  • October 22, 2013
  • 2 replies
  • 14 views

eli_revach
Forum|alt.badge.img+2
Hi 
We like to use Vertica HASH() function, for generating numbers on top of scripts , did  HASH function gurenty Uniqes ? so  two diffrent string will never have the same same hash number ?.

2 replies

Daniel_Leybovic
Forum|alt.badge.img+1
  • Participating Frequently
  • October 24, 2013
>> did  HASH function gurenty Uniqes ?
No.
Hash
Calculates a hash value over its arguments, producing a value in the range 0 <= x < 2^63.
So uniqueness not guaranteed, in sequence 0 <= Seq <= 2^63 + 1 must be exists at least one duplicate.
Pigeonhole principle: http://en.wikipedia.org/wiki/Pigeonhole_principle




eli_revach
Forum|alt.badge.img+2
  • Author
  • Participating Frequently
  • October 24, 2013
I agree ,i more ask about vertica imlemention