最好指定在表中选择记录所需要的列,而不是使用表中的select *. [英] Is it better to specify the columns you need in selecting a record in table rather than using select * from a table.

查看:100
本文介绍了最好指定在表中选择记录所需要的列,而不是使用表中的select *.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我想知道,如果最好在表中选择列而不是在表中使用select *来指定列,如果我将在查询中指定需要的列,我是否可以更快地搜索或检索记录? /> 在表中使用select *的缺点和在表中选择指定列的优点,

请对此提供帮助,我确实需要我的问题的具体答案,这将对我构建代码有很大帮助,并且我也希望我的查询能够很好地检索并连接到数据库,

谢谢..

Greetings,

i want to know, if its better to specify the columns in selecting in a table rather than using a select * in a table, will i have faster searching or retrieval of records if i will specify the columns i need in a query?
what is the disadvantage of using select * in a table and advantage of selecting the specified columns in a table,

Please help me on this, I really need an concrete answer to my question, it will help me a lot in constructing my code, also i want my query to have good retrieval and connection to my database,

Thank you..

推荐答案

最好指定列,而不要使用*.原因之一是查询引擎可以更好地优化查询,知道列和类型是什么,而不必用宽*来猜测.当使用广泛的表或在查询中使用多个表时,这尤其重要.借助此信息,可以形成更优化且可能有效的TDS,并将其发送给请求的代理.

另一个原因是代码的可读性和维护性.您将明确知道使用了哪些列.
It is better to specify the columns rather than using *. One reason is the query engine can optimize the query better knowing what the columns and types are rather than having to take a guess with a broad *. This can be particularly important when using tables that are broad, or when using multiple tables in a query. With this information a more optimized and possibly efficinet TDS can be formed and sent to the requesting agent.

Another reason is for code readability and maintenance; you will know specifically which columns are used.


这篇关于最好指定在表中选择记录所需要的列,而不是使用表中的select *.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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