From: | Scott Ribe <scott_ribe(at)killerbytes(dot)com> |
---|---|
To: | Ranjan Kumar Baisak <rbaisak(at)nyc(dot)yamaha(dot)com>, PgSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Disadvantage of SQL Joins |
Date: | 2006-11-29 16:17:55 |
Message-ID: | C19300C3.5C5A5%scott_ribe@killerbytes.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> I am in the impression that SQL join takes more time for
> execution as well as space because database internally builds Cartesian
> product and then evaluates for condition.
No, that's a conceptual description, but the actual process is more
optimized, often far more so if you have the appropriate indices.
> Recently I normalized by DB
> and changed my application Data model which resulted in writing lots of
> inner join queries. Later I found that DB server is consuming more
> memory.
That can certainly happen. There is a tradeoff there, in that reduction of
redundant data and the problems of maintaining it may require more CPU
cycles and RAM to get data back out.
> And once my Database also crashed. I am assuming that because of
> normalization and inner joins, my DB crashed.
Not likely. When you construct your joins, do be careful about the join
conditions. A common mistake is to leave out a condition in the where clause
which then results in the actual Cartesian product being requested. The more
tables involved in a join, the easier it is to make such a mistake--I think
we've all done this at one time or another.
--
Scott Ribe
scott_ribe(at)killerbytes(dot)com
http://www.killerbytes.com/
(303) 722-0567 voice
From | Date | Subject | |
---|---|---|---|
Next Message | Ritesh Nadhani | 2006-11-29 16:21:35 | Re: Development of cross-platform GUI for Open Source DBs |
Previous Message | Tony Caduto | 2006-11-29 16:17:51 | Re: Only MONO/WinForms is a way to go |