在数据库中通过其哈希码搜索一个大的字符串会更快吗? [英] Is it faster to search for a large string in a DB by its hashcode?

查看:126
本文介绍了在数据库中通过其哈希码搜索一个大的字符串会更快吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我需要从一个数据库中检索一个大的字符串,它是更快的搜索它使用字符串本身,或者我会通过哈希字符串和存储散列在数据库中获得,然后基于此搜索?

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 well and then search based on that?

如果是,我应该使用什么哈希算法(安全不是问题,我在寻找性能)

If yes what hash algorithm should I use (security is not an issue, I am looking for performance)

如果重要:我使用C#和MSSQL2005

If it matters: I am using C# and MSSQL2005

推荐答案

如果这提供巨大的改进,不使用自己的性能优化进行数据库搜索。

I'd be surprised if this offered huge improvement and I would recommend not using your own performance optimisations for a DB search.

如果使用数据库索引,DBA使用经过尝试和可信的方法来调整性能的范围。硬编码自己的索引优化将防止这种情况,并且可能会阻止您在未来版本的数据库的索引中获得任何性能改进。

If you use a database index there is scope for performance to be tuned by a DBA using tried and trusted methods. Hard coding your own index optimisation will prevent this and may stop you gaining for any performance improvements in indexing in future versions of the DB.

这篇关于在数据库中通过其哈希码搜索一个大的字符串会更快吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆