SQL Server 通配符 [英] SQL Server wildcard
问题描述
Does 要回答你的问题,需要拆开一点: To answer your question, it needs to be picked apart a little: Select * from 是否具有相同的性能含义关于通配符解释 Does Select * from have the same performance implication
regarding wildcard interpretation 我不确定您所说的关于通配符解释的含义"是什么意思,但我怀疑您误解了为什么 SELECT * 是个坏主意 - SQL 引擎无论如何都会验证提供的列;扩展"通配符的成本本质上是0. I'm not sure what you mean by "implication regarding wildcard interpretation", but I suspect you're misunderstanding why SELECT * is a bad idea - the SQL engine validates provided columns anyway; the cost of "expanding" the wildcard is essentially 0. 假设存储过程是代码的编译单元 given that the stored procedure is a compiled unit of code 存储过程并不是真正的代码编译单元":存储过程的查询计划通常会在第一次运行后被缓存,但在许多/大多数情况下,ad-hoc SQL 语句实际上也是如此情况. A stored procedure is not really a "compiled unit of code": the query plan for a stored procedure will usually be cached after it first runs, but the same is actually true of ad-hoc SQL statements also in many/most circumstances. 现在,要实际回答您的问题:是,在临时 SQL 中使用 Now, to actually answer your question: Yes, any disadvantages of using 这篇关于SQL Server 通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!Select * from
在动态 T-SQL 语句中使用与在存储过程中使用通配符解释时是否具有相同的性能影响,假设存储的过程是编译后的代码单元吗?
Select * from <table/view>
have the same performance implication regarding wildcard interpretation when used in a dynamic T-SQL statement as against using it in a stored procedure, given that the stored procedure is a compiled unit of code?推荐答案
SELECT *
有 3 种主要类型的缺点:SELECT *
has 3 main types of disadvantages:
SELECT *
的任何缺点也同样适用于存储过程中的 SQL.SELECT *
in ad-hoc SQL also apply, equally, to SQL inside of a stored procedure.
登录
关闭