SQL:空列对研究速度的影响?
我想知道某些空列(例如字段“null”)是否会降低在索引列或普通列上进行查询“SELECT”的速度。
谢谢,
巴
I'd like to know if some empty columns (with the field 'null' for example) can decrease the speed to make a query "SELECT" on a indexed column or a normal column.
Thanks,
Ba
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果这些列返回给客户端,那么是的。返回额外的列,即使它们有 NULL,也会占用更多空间。
额外的列也可能对子查询产生影响,但是如果不需要,好的优化器应该将它们从结果中删除。
If the columns are returned to a client, then yes. Returning the extra columns, even if they have NULLs, will take more space.
The extra columns might also have an impact on sub-queries, but a good optimizer should drop them out of the results if they are not needed.
如果已建立索引,则具有相同值(例如 null 或空白)的多行可以使您的查询速度更快。不过,差异可能并不明显,除非您的表很大,并且您从完全随机的值变为只有几个不同的值。
未索引的列不会产生任何影响。
If it's indexed, multiple rows with the same value (null or blank for example) could make you query faster. The difference would probably be unnoticeable though, unless your table was huge, and you went from totally random values to just a couple of different values.
Unindexed columns wouldn't make any difference.