all groups > sql server new users > october 2007 >
You're in the

sql server new users

group:

Table joins and views nesting; maximum


Table joins and views nesting; maximum Barry Burke
10/28/2007 12:00:00 PM
sql server new users:
Whats the 'normal' maximum count of tables in a join and what if there are
views involved.
Re: Table joins and views nesting; maximum Tom Moreau
10/28/2007 3:13:19 PM
A single query - including a view - can access up to 256 tables. Typically,
joins involve 2 - 4 tables but can often go beyond that. It depends on the
app and how normalized your schema is.

--
Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


[quoted text, click to view]
Whats the 'normal' maximum count of tables in a join and what if there are
views involved.
What about nesting views
Re: Table joins and views nesting; maximum Hugo Kornelis
10/28/2007 9:48:35 PM
[quoted text, click to view]

Hi Barry,

Tom answered the first question.

Re the second questions - views are somewhat like macros: they get
replaced with their definition before the query is compiled. That means
that if you for instance have a view that uses four tables and another
view that uses three tables, a query that uses these two views
effectively uses seven tables.

Nesting doesn't change this either - if you create a new view from the
query that uses the two views above, and then query this new view, you
are still effectively querying seven tables. And if you write a query
that joins this new view to itself, you're already at fourteen tables.

--
Hugo Kornelis, SQL Server MVP
AddThis Social Bookmark Button