为什么使用“从表中选择字段1,字段2 ...”是比“从表中选择*”更好的表现? [英] Why using "Select field1,field2... from table " is better performance than "Select * from table "?

查看:69
本文介绍了为什么使用“从表中选择字段1,字段2 ...”是比“从表中选择*”更好的表现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么使用选择EmployeeId,来自empTable的EmployeeName 选择*来自empTable 更好的表现?



假设在 empTable 中有两个字段 EmployeeId EmployeeName

如果我们想要检索所有记录然后我们可以使用以下命令

从empTable中选择*;

但性能更好。 ..如果我们使用

从empTable中选择EmployeeId,EmployeeName; 命令。



请告诉我原因?

Why using "Select EmployeeId,EmployeeName from empTable" is better performance than "Select * from empTable"?

Let assume that in empTable there is two field EmployeeId and EmployeeName
if we want to retrieve all the records then we may use the following command
Select * from empTable;
but the better performance ...if we use
Select EmployeeId,EmployeeName from empTable;command.

please tell me why?

推荐答案

请参阅此链接



十大SQL性能提示 [ ^ ] [请参阅tip3和tip4] < br $> b $ b

SQL调优或SQL优化 [ ^ ]



:doh:



高效的SELECT语句 [ ^ ]



问候......:笑:
Refer to this link

Top Ten SQL Performance Tips[^][Refer to tip3 and tip4]

SQL Tuning or SQL Optimization[^]

:doh::

Efficient SELECT statements[^]

Regards.. :laugh:


i想想,在这种情况下性能没有变化



但在案例中



表有10列但是你只需要3列,这样可以提高性能



* - 这将返回表格中的所有列 - >降低性能



指定 - 仅返回指定的列 - >提高性能
i think, in this scenario no change in performance

but in cases

table have 10 columns but you need 3 columns only, in that this improves performance

* - which will return all columns in the table -> degrades performance

specified - will returns specified columns only -> improves performance


这篇关于为什么使用“从表中选择字段1,字段2 ...”是比“从表中选择*”更好的表现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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