SQL performance searching for long strings

前端 未结 2 1012
小鲜肉
小鲜肉 2021-01-18 20:49

I need to store user agent strings in a database for tracking and comparing customer behavior and sales performance between different browsers. A pretty plain user agent str

2条回答
  •  执笔经年
    2021-01-18 21:09

    Your hash idea is sound. I've actually used hashing to speed up some searches on millions of records. A hash index will be quicker since each entry is the same size. md5 will likely be fine in your case and will probably give you the shortest hash length. If you are worried about hash collisions, you can add include the length of the agent string.

提交回复
热议问题