Hello everyone,
sorry to bother everyone , but i am still new to databases and indexing and i am trying to build my first CMS system.
i am building a database system in which members will be able to communiate with each other via sent messages sent. The messages will be stored in a database and members will be able to retrieve the messages via a sql commands .
this is the sql command for the creation of the database table
[php]
CREATE TABLE massages(
receiver_id int(11) NOT NULL ,
sender_id int(11) NOT NULL ,
messages varchar(255) NOT NULL,
date_sent varchar(255) NOT NULL,
receiver_memtype varchar(30) NOT NULL,
INDEX massage (receiver_id)
);
[/php]
my question now is this;
is the index i have used correct and also the best way to way to access the messages .
i anticipate having millions of messages, so i will obviously need to be able to acess them quickly.
should i index it the following way
INDEX massage (receiver_id, sender_id )
Also, i am not sure how to do the sql command so that messages will follow on from each other. i.e if a user respond to a message,how do i get the messages to follow on from each other. i.e should the messages each have a seperate Id number.
warm regards
andreea