Re: Joins and Scability
From: David Browne (meat_at_hotmail.com)
Date: 10/21/04
- Next message: jaylou: "Re: Case clause in a join"
- Previous message: Mingqing Cheng [MSFT]: "RE: IN vs EXISTS vs INNER JOIN"
- In reply to: Amol: "Joins and Scability"
- Next in thread: Al: "RE: Joins and Scability"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 21 Oct 2004 09:10:26 -0500
"Amol" <apk@nospam.cbord.com> wrote in message
news:OX0ZWN3tEHA.2300@TK2MSFTNGP09.phx.gbl...
> Hi All,
> We have a client server application where a lot of business logic is
> executed in stored procedures in SQL Server. Our procedures use a lot of
> complex joins between 3-4 tables or more. While I dont have specific
> examples to show, I was hoping for some general pointers on how joins
> affect positively and negatively on scability. What are the dos and donts.
> Any articles on this will also be very helpful.
>
When you start joining tables you introduce a new area of concern for your
application's performance.
The good news is that joins on properly indexed tables are cheap, and the
better news is that executing business logic in SQL is generally much faster
and cheaper than doing it in client code.
The bad news is that you need to learn about query excution plans, logical
vs physical io, indexing strategies, profiling, server workloads,
parallelism, SQL performance do's and don'ts. You'll find that many of the
so-called rules for database design are really just rules-of-thumb to
protect developers from having to learn too much about the database. "Joins
are slow" is one of those so-called rules.
Some quick pointers for joins
DO build an index for every foreign key
DONT use expressions in a where-clause
DO write your queries by hand in QueryAnalyzer (query builders only hide
things you really need to know)
DO examine the execution plan of your queries when you are writing them
DO write views which join tables together in handy ways
David
- Next message: jaylou: "Re: Case clause in a join"
- Previous message: Mingqing Cheng [MSFT]: "RE: IN vs EXISTS vs INNER JOIN"
- In reply to: Amol: "Joins and Scability"
- Next in thread: Al: "RE: Joins and Scability"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|