Forum Moderators: open

Message Too Old, No Replies

What's a better way to call data

Store data twice or call data twice?

         

Murdoch

1:38 pm on Apr 10, 2008 (gmt 0)

10+ Year Member



I'm in a situation where I'll be storing mass amounts of data in a MySQL database (InnoDB) and I've come across a situation where I'm storing messages sent from one user to another (kind of like MySpace) but I'm unsure whether the potential of high usage of the site calls for one of two different scenarios. Do I:

A. List the messages by making two queries; one for the user information and one for the message information.

B. Save the necessary user information (name, id, link to image) in the message table along with the message

or

C. Completely rethink my methodology on how to store message data?

Thanks
-Doc

physics

7:38 pm on Apr 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have two normalized tables

user
id
name
image

message
id
id_user_send
id_user_rec
timesent
message_text

Then you use join queries to get the info you need. I guess this is like you were saying with option A. But you don't necessarily need to make two queries to get both the user and message info if you use a JOIN.

[dev.mysql.com...]