SQL Server 2008 Performance Tuning (T-SQL) Multiple LEFT JOIN Table vs. View

I have 20+ supporting tables created as follows.

[common_column1, common_column2, unique_column]

I need to create a combo table or view that will be customized this way

[common_column1, common_column2, 
 table1_unique_column, table2_unique_column, table3_unique_column, etc...]

I have 6 million records in each supporting table. My combined query to create a table / view is as follows:

select 
   a.common_column1, a.common_column2, a.unique_column, b.unique_column, 
   c.unique_column, d....  
into combined_table  
from table1 as a   
left join table2 as b on (a.common_column1 = b.common_column1 and a.common_column2 = b.common_column2)  
left join table3 as c on (a.common_column1 = c.common_column1 and a.common_column2 = c.common_column2)  
left join table4 as d ...`   

- /, . , : , ? - ?

+3
3

LEFT JOIN, , , .

LEFT JOIN - "", .

, , , WHERE (s ) - , , ...

: , ... !

+2

, - , .
, , , , .
, . , . , "where".
, .

0

:

CREATE INDEX ix_b_1_2_unique ON b (common_column1, common_column2) INCLUDE (unique_column)

, .

2 (common_column1, common_column2) , 1048576 a.

? , , ?

0

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


All Articles