Search Postgresql Archives

Re: Disadvantage of SQL Joins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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@xxxxxxxxxxxxxxx
http://www.killerbytes.com/
(303) 722-0567 voice




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux