|
Posted by Lόpher Cypher on 01/03/06 20:40
Scot McConnaughay wrote:
> I agree, this is probably a good topic for a database forum, more than
> for the PHP forum... but, since it is here:
>
> What would be the advantage of having a table for each thread, does that
> not go against the idea of database normalization? I would think that it
> would cause quite a few duplicate fields, at least in the fact that each
> 'thread' table would be essentially the same.
It does go against it :)
And that's just it - think of it this way:
Database is used to store information about the world (that has some
known objects)
Table is used to store information about different objects and/or how
they relate to each other
Fields are used to describe objects
When designing a database, it is best to first think of which objects
the world consists of. In this case, the world is the forum, the objects
are threads and messages. Then, one thinks about what attributes
describe objects (for example, a thread has a unique id, topic, etc., a
message has a unique id, date, maybe a name of the poster, etc.) Then
objects become tables and attributes become fields. Finally, relations
between them are made.
Putting each thread in a separate table is basically saying that each
thread is a different object..
>
> Also, it seems to me that SQL / MySQL is very fast. If the database is
> on a decent server what would be the speed advantage of each thread
> having its own table?
>
Yes, it is :) You'll probably not see sufficient change in speed, unless
there is millions of records. So, I don't see any advantage in using
separate tables. I see a disadvantage, though :) First, one has to
remember that each table is stored in a separate file, plus, there are
index files. Then, suppose I want to add another attribute to thread.
Having one table, it's easy. Having thousands of tables - not so easy :)
--
- lΓΌpher
---------------------------------------------
"Man sieht nur das, was man weiΓ" (Goethe)
[Back to original message]
|