SQL查询性能问题-如何使用哈希技术? [英] SQL Query performance issue - How to use hashing technique?
问题描述
我遇到了一个简单的查询问题,这需要花费大量时间.我有一个带有Dummy_Table的表,其中的列A,B,C等多达15列.
我有一个简单的查询,就像这样.
I am facing a problem with a simple query which is taking lot of time. I have a table with Dummy_Table with coumns A, B, C etc upto 15 columns.
I have a simple query which goes like this.
select count(*) from Dummy_Table where A = ''bdfb'' and B = ''gg'' and Z = ''ggdg'' and P = ''nmlk'' and S = ''giuh''
该Dummy_Table已获得约3000万条记录.
上面的查询大约需要30秒才能执行.我的目标是将其降低到不到1秒.
我尝试设置适当的索引,将Index和where子句的顺序保持不变,但无法获得所需的结果.
我会要求该论坛中的任何人为我提供适当的解决方案.我还听说我们可以通过使用哈希函数来提高性能.任何人都可以帮助我有关如何做到这一点.
预先感谢.
This Dummy_Table has got about 30 million records.
The above query is taking about 30 secs to execute. My target is to bring it down to less than 1 sec.
I tried setting the proper indexes, keeping the order of Index and where clause as same but I am unable to get the required result.
I would request anyone in this forum to suggest me an appropriate solution. I also heard that we can improve the performance by using Hashing functions. Can anyone help me regarding how we can do that.
Thanks in advance.
推荐答案
您可以尝试使用临时表-但实际上,将IMO的30秒降为1太陡了.
You can try using temp tables - but really, bringing 30 secs down to 1 is too steep a requirement IMO.
这篇关于SQL查询性能问题-如何使用哈希技术?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!