nerdexam
Microsoft

70-465 · Question #73

You need to recommend a solution to minimize the amount of time it takes to execute USP_1. With what should you recommend replacing Table1?

The correct answer is A. A view. To minimize execution time of a stored procedure that references a table, replacing the table with a view allows the query optimizer to inline the view definition and optimize the full query plan without materializing intermediate results.

Submitted by daniela_cl· Mar 5, 2026Design and implement database solutions for SQL Server

Question

You need to recommend a solution to minimize the amount of time it takes to execute USP_1. With what should you recommend replacing Table1?

Options

  • AA view
  • BA temporary table
  • CA table variable
  • DA function

How the community answered

(33 responses)
  • A
    55% (18)
  • B
    24% (8)
  • C
    6% (2)
  • D
    15% (5)

Why each option

To minimize execution time of a stored procedure that references a table, replacing the table with a view allows the query optimizer to inline the view definition and optimize the full query plan without materializing intermediate results.

AA viewCorrect

A view is a named query definition stored in the database that the SQL Server query optimizer can inline directly into the calling query, enabling full optimization across the entire execution plan. Unlike temporary tables or table variables, a view does not require materializing an intermediate result set, which reduces I/O and overhead. This allows USP_1 to benefit from statistics, indexes on the underlying base tables, and optimal join ordering determined by the optimizer.

BA temporary table

A temporary table requires physically writing rows to tempdb and materializing the result set before the outer query can use it, which adds I/O overhead and prevents the optimizer from optimizing across the boundary.

CA table variable

A table variable also materializes an intermediate result set and has limited statistics (only a single-row estimate), which can lead to poor cardinality estimates and suboptimal execution plans, increasing rather than minimizing execution time.

DA function

A scalar or multi-statement table-valued function introduces per-row execution overhead and prevents the optimizer from pushing predicates inside the function body, typically degrading rather than improving performance.

Concept tested: Optimizing stored procedure performance using views

Source: https://learn.microsoft.com/en-us/sql/relational-databases/views/views?view=sql-server-ver16

Topics

#SQL Server performance#Views#Query optimization

Community Discussion

No community discussion yet for this question.

Full 70-465 Practice