Table Values ​​Function in which my query plan was executed?

I just wrapped a complex SQL statement in a table function on SQLServer 2000. When I look at the query plan for SELECT * FROM dbo.NewFunc it just gives me a scan of the table from the table I created.

I assume this is because the table is created in tempdb, and I just select it.

So the request is simple:

SELECT * FROM table in tempdb

My questions:

Is UDF the same plan as a complex SQL statement?

How to configure indexes for this UDF?

Is it possible to see the true plan?

+3
source share
1 answer

(TVF) - . IO, CPU .. .

TVF , - . , where , .

, TVF , .

SELECT TOP 1 x FROM db.MyTVF ORDER BY x DESC

/ , , . ..

: / ? JOIN vs APPLY Microsoft SQL Server 2008

: no, no no

TVF: , UDF.

+6

Source: https://habr.com/ru/post/1717819/


All Articles