«

»

Feb 24

Collision or Synonym in Teradata



Teradata is consistent with hashing a value. It means that when Teradata hashes the Index value (e.g. ‘teradatatech’) it will come up with a Row Hash. Now if Teradata hashes the same index value (‘teradatatech’) million times it will always come up with the same Row Hash. Teradata always hashes the same value with consistent results.

However, Teradata can hash two very different values and the result can sometimes be the same Row Hash. This is a called a Collision. It is sometimes called a Synonym.


The AMP always double checks the Primary Index Value to insure it is getting the correct row. The AMP double checks because it is afraid if it does not it could get the wrong row because of a Collision!

Teradata searches for a Primary Index value by hashing the Primary Index Value and then using the Row Hash and the Hash Map to point to a specific AMP. The AMP then uses using a Binary Search of the Row Hash to find the row it is looking for.


For e.g. we have the name ‘teradatatech’ and ‘teradata’ and that they both have the same Row Hash of 11000. This is a collision.


This is why the AMP double checks. It finds ‘teradatatech’ with a binary search on 11000, but checks the value for integrity.

↓↓↓↓↓↓↓↓ SHARE IT WITH YOUR FRIENDS  ↓↓↓↓↓↓↓↓

4 comments

Skip to comment form

  1. shashi

    Hi Admin,

    even after double check how will PE know which row to fetch in case of collision as row hash value will be same. will it be based on the uniqueness value?

    Thanks
    Shashi

    1. Rohit

      Hi Shashi,

      Teradata will check both row hash value and data itself (‘teradatatech’ in this case)
      so even if row hash values are same teradata will distinguish it based on value (data) of primary index.

      hope it helps !!

      Cheers
      Rohit

  2. Kumar

    Hi Admin,
    You have mentioned the below given line in the above post:

    However, Teradata can hash two very different values and the result can sometimes be the same Row Hash. This is called a Collision. It is sometimes called a Synonym.

    — For what reason or in which situation there can be same row hash for two very different values?

  3. Teradata Guide

    Nice explanation.Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>