最好指定在表中选择记录所需要的列,而不是使用表中的select *.

编程入门 行业动态 更新时间:2024-10-28 00:26:34
本文介绍了最好指定在表中选择记录所需要的列,而不是使用表中的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 *.

本文发布于:2023-10-30 11:20:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1542708.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:所需要   而不是   select

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!