Remove articles inner-source
article thumbnail

Fundamentals of Table Expressions, Part 11 – Views, Modification Considerations

SQL Performance

This article is the eleventh part in a series about table expressions. In Part 9 I compared views to derived tables and CTEs, and in Part 10 I discussed DDL changes and the implications of using SELECT * in the view’s inner query. In this article, I focus on modification considerations. Sample Data. FastOrders.

Servers 130
article thumbnail

Fundamentals of table expressions, Part 2 – Derived tables, logical considerations

SQL Performance

For example, the expression can be a table value constructor, as I will explain later in this article. With table expressions you can reuse aliases that you define in an inner query in any clause of the outer query, and this way avoid repetition of lengthy/complex expressions. I'll get to this one later in the article.

C++ 143
Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

Fundamentals of table expressions, Part 5 – CTEs, logical considerations

SQL Performance

This article is the fifth part in a series about table expressions. The source of the term aside, common table expression , or CTE , is the commonly used term by T-SQL practitioners for the structure that is the focus of this article. Of course, I’ll demonstrate this design aspect in this article. The outer query.

C++ 140
article thumbnail

Nested Loops Joins and Performance Spools

SQL Performance

Performance spools are lazy spools added by the optimizer to reduce the estimated cost of the inner side of nested loops joins. An example plan shape showing a lazy table performance spool is below: The questions I set out to answer in this article are why, how, and when the query optimizer introduces each type of performance spool.

article thumbnail

Are You Sorted? Tips Concerning T-SQL Window Ordering

SQL Performance

You can download the source code to create and populate this database here. In this article, I want to focus on tips having to do with the potential of the window function’s calculation in the plan to rely on ordered input data without requiring an extra explicit sort activity in the plan. FROM C1 INNER JOIN C2 ON C1.

C++ 133
article thumbnail

T-SQL bugs, pitfalls, and best practices – Joins

SQL Performance

This article is the third installment in a series about T-SQL bugs, pitfalls and best practices. In this article I focus on four classic common bugs: COUNT(*) in outer joins, double-dipping aggregates, ON-WHERE contradiction and OUTER-INNER join contradiction. Orders AS O INNER JOIN Sales. This time I focus on joins.

article thumbnail

The Eager Index Spool and The Optimizer

SQL Performance

To be accessed more than once, the spool must appear on the inner side of a nested loops join operator. For the difference between the two, please see my article Apply versus Nested Loops Join. For the difference between the two, please see my article Apply versus Nested Loops Join. Notable features. ProductID , P. [

Servers 77