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

前端 未结 10 2485
余生分开走
余生分开走 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:19

    Are you doing an equality match, or a containment match? For an equality match, you should let the db handle this (but add a non-clustered index) and just test via WHERE table.Foo = @foo. For a containment match, you should perhaps look at full text index.

提交回复
热议问题