|
Posted by Jerry Stuckle on 03/29/06 14:05
chris.withers@gmail.com wrote:
> I have built a web portal and was considering adding a 'user mail'
> feature for users to message each other. I'm a bit uncertain on how to
> design the DB, so was wondering if there is a standard to do this. I
> was figuring perhaps a table storing all user messages (but this might
> become very large very fast?) or would a seperate db storing
> sent/saved/recieved etc messages be better?
>
> Any advice would be appreciated,
>
>
> Chris
>
>
> Ps I'm unsure if this is the right group, but couldn;t find anything
> concerning php and Dbs which seemed more appropriate.
>
Hi, Chris,
First of all, no, this isn't the "wrong group" for the question. I don't know
what a "right group" would be :-).
There's no real standard for designing the DB for something like this. It's up
to you how to do it.
If I were doing it, I would keep the body of the message in a separate table,
something like:
First table:
msgid
from
to
date
subject
status (sent/received/saved)
Second table:
msgid
msgtext
The reason for keeping the message itself separate is speed. As you note, the
file could become very big. You don't want the messages every time you scan -
for instance, when you display the list of messages available to the user.
Keeping the text in a separate table will speed up these requests, at least with
MySQL. Of course, displaying the actual message will be slightly slower, but
you won't be doing that as much as just displaying to/from/subject.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|