English 中文(简体)
T-SQL 启用了统计时间的实际询问执行时间吗?
原标题:Which is the actual query execution time with Statistic Time enabled in T-SQL?

当在 SQL 服务器管理工作室 SQL Sever 选项中启用统计时间时, 我能得到以下信息 。

SQL Server parse and compile time: CPU time = 15 ms, elapsed time = 47 ms.

(受影响的1745行)

SQL Server Execution Times: CPU time = 31 ms, elapsed time = 99 ms. SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 0 ms.

以毫秒计有四倍。 现在, 哪个是运行查询的实际时间? 它们似乎不是相对的 。

问题回答

这取决于你说的"运行查询所需时间"是什么意思

分析时间是准备查询所需的时间, 通过语法检查它, 并创建高度标准化的任务列表 。

简单时间是通过 Algerbrizer 运行查询所需的时间( 这是将对象名称转换为对象代号等的组件), 然后选择或创建查询执行计划 。

这两个阶段所花费的时间加在一起记录为 " 分析与汇编时间 " 。

执行时间是实际执行或运行已编译的计划所需的时间。 因此, 如果您指的是执行查询需要多长时间, 那么这是 SQL 服务器执行时下的过期时间 。

但是,如果你指的是从我打中执行的那一刻开始,完成查询需要多长时间,那么这就是在剖析和编译时间部分以及SQL服务器执行时段的SUM 过期时间部分。

CPU Times( 包括分析与汇编部分以及执行时间部分) 是处理者在这个章节上花费的时间。 因此计算时间长度时, CPU Times 可以被忽略 。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签