什么才需要SELECT *或SELECT`field`呢? [英] What is faster SELECT * or SELECT `field` when only requiring `field`

查看:220
本文介绍了什么才需要SELECT *或SELECT`field`呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想在这里假设,我之前被咬过/被证明是错误的.

I don't want to assume here, I've been bitten/proven wrong before.

任何帮助将不胜感激

推荐答案

SELECT字段比选择*更快.

SELECT field is faster than select *.

因为表中的字段/列多于1个,所以选择*将返回所有字段/列,这需要网络带宽更多的数据库工作获取所有其他字段.但是,如果只需要一个字段/列,那么数据库的负载就会减少,并且不需要传输不需要的信息,因此就不必占用带宽资源.

Because if you have more than 1 field/column in your table then select * will return all of those, and that requires network bandwidth and more work for the database to fetch all the other fields. But if you only require one field/column, the database load is less and it doesnt need to transmit unneeded information and thus take bandwidth resources uncesseraly.

这篇关于什么才需要SELECT *或SELECT`field`呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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