Is it faster to search for a large string in a DB by its hashcode?

前端 未结 10 2504
余生分开走
余生分开走 2020-12-17 19:32

If I need to retrieve a large string from a DB, Is it faster to search for it using the string itself or would I gain by hashing the string and storing the hash in the DB as

10条回答
  •  感动是毒
    2020-12-17 20:15

    If your strings are short (less than 100 charaters in general), strings will be faster.

    If the strings are large, HASH search may and most probably will be faster.

    HashBytes(MD4) seems to be the fastest on DML.

提交回复
热议问题