简体   繁体   English

索引是否可以帮助包含大量列但记录数量较少的表?

[英]Do indexes help tables with large number of columns but small number of records?

I am under the assumption that indexes help you find particular records based on hashing on a combination of 1 or more columns. 我假设索引可以帮助您根据1个或更多列的组合上的散列来查找特定记录。 If this is the case, then a large table with a lot of columns but few records will not benefit much from indexes. 如果是这种情况,那么具有大量列但记录很少的大型表将不会从索引中获益。 Is this correct? 它是否正确?

That's correct. 那是对的。 On smaller tables (and depending on the query) it is going to be more efficient to just scan the whole table than to assemble the results based on a seek on a specific index and then a lookup to get the rest of the results. 在较小的表(并且取决于查询)上,仅扫描整个表比基于对特定索引的搜索组装结果然后查找以获得其余结果更有效。

There is no magic row count or other formula here, though. 但是,这里没有魔术行计数或其他公式。 Too many variables to make a blanket statement. 太多变量要做出一揽子陈述。 Just something you should be aware of. 只是你应该注意的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM