By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,276 Members | 2,137 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,276 IT Pros & Developers. It's quick & easy.

Join Small Table to Big Table or Vice Versa, does it matter?

P: n/a
If I join Table1 to Table2 with a WHERE condition, is
it the same if I would join Table2 to Table1 considering
that the size of the tables are different.

Let's assume Table2 is much bigger than Table1.

I've never used MERGE, HASH JOINs etc, do any of
these help in this scenario?
Thank you
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
serge (se****@nospam.ehmail.com) writes:
If I join Table1 to Table2 with a WHERE condition, is
it the same if I would join Table2 to Table1 considering
that the size of the tables are different.

Let's assume Table2 is much bigger than Table1.
For an inner join the order does not matter.
I've never used MERGE, HASH JOINs etc, do any of
these help in this scenario?


These are optimizer hints, and you should use them if you can get
good performance in any other way.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #2

P: n/a
> If I join Table1 to Table2 with a WHERE condition, is
it the same if I would join Table2 to Table1 considering
that the size of the tables are different.
Yes.
I've never used MERGE, HASH JOINs etc, do any of
these help in this scenario?
No.

--
David Portas
SQL Server MVP
--

"serge" <se****@nospam.ehmail.com> wrote in message
news:7_*********************@wagner.videotron.net. .. If I join Table1 to Table2 with a WHERE condition, is
it the same if I would join Table2 to Table1 considering
that the size of the tables are different.

Let's assume Table2 is much bigger than Table1.

I've never used MERGE, HASH JOINs etc, do any of
these help in this scenario?
Thank you

Jul 23 '05 #3

P: n/a
On Tue, 21 Jun 2005 17:52:02 -0400, serge wrote:
If I join Table1 to Table2 with a WHERE condition, is
it the same if I would join Table2 to Table1 considering
that the size of the tables are different.

Let's assume Table2 is much bigger than Table1.
It doesn't matter because the query optimizer will go through thousands of
optimization iterations and choose the best plan it found so far in the
time frame it knows it should not spend any further.

I've never used MERGE, HASH JOINs etc, do any of
these help in this scenario?


no.. The query optimizer is smart enough to choose the best plan.
Tony
--
http://www.dotnet-hosting.com
Free web hosting with ASP.NET & SQL Server
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.