Jump to content


Photo

What's the most tables you have joined?


  • Please log in to reply
6 replies to this topic

#1 extrovertive

extrovertive
  • Members
  • PipPipPip
  • Advanced Member
  • 235 posts

Posted 14 September 2006 - 05:40 AM

On one of my website I did for a client, I had to join 10 tables together.

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 14 September 2006 - 08:02 AM

Only two or three, and that is typically something like users and groups or forums, topics and posts.

#3 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 14 September 2006 - 08:44 AM

Only five or so. Full normalization doesn't become that usefull untill you have tables that can potentially get huge, creating a huge amount of repeated data. So on a database that isn't likely to become that big, out of pure lazyness  :P, I use it with moderation.

#4 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 18 September 2006 - 06:19 AM

Only five or so. Full normalization doesn't become that usefull untill you have tables that can potentially get huge, creating a huge amount of repeated data. So on a database that isn't likely to become that big, out of pure lazyness  :P, I use it with moderation.


Moderation? Like in a forum system?

I have a cache table containing things like group information, moderators, settings etc. so I can read from a lot of tables with only one query. The cached information is updated each time it's edited by an admin or so.

#5 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 18 September 2006 - 11:39 AM

If you are joining double figure tables, and repeating the process (i.e. not just a one off query) you definitely need to look into using VIEW's.

JOIN's can be inefficient compared to VIEW's, in both computing power and maintenance (by developers)

Whenever I find I need to make more than 3 joins, I make views.

#6 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 18 September 2006 - 07:37 PM

Moderation? Like in a forum system?


LOL, and English isn't even my native language...  :P

Moderation is the process of eliminating or lessening extremes. It is used to ensure normality throughout the medium on which it is being conducted.

mod·er·ate Pronunciation (mdr-t)
adj.
1. Being within reasonable limits; not excessive or extreme: a moderate price.



#7 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 18 September 2006 - 07:47 PM

If you are joining double figure tables, and repeating the process (i.e. not just a one off query) you definitely need to look into using VIEW's.

JOIN's can be inefficient compared to VIEW's, in both computing power and maintenance (by developers)

Whenever I find I need to make more than 3 joins, I make views.


agreed. i've had one application where i ended up joining 12+ tables, so i ended up writing up about 4 different views that i could query from, so in the completed app, i never had more than 4 joins... very useful
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users