If I join tables from database A to a view in database B (same server), are the joins within the view in database B processed on database B before joining to the tables in the current database?
Asked
Active
Viewed 95 times
1 Answers
1
Views are inlined into the query plan. Optimization then proceeds not even knowing that there once was a view.
The execution algorithm in general is not directly dictated by the way the query is written.
The join order in particular is very indirectly related to the way you wrote the joins.
So the answer depends on your particular schema, data and query. Likely, the answer is that the way you write the joins has no or has little impact.
You can find out by comparing the actual execution plans.
usr
- 7,390
- 5
- 33
- 58