I do not know too many things about databases, so a lot of questions concerning architecture came up lately. Two of these things are:
If I have a table with a lot of entries(millions probably), how can I make the
selectqueries faster? I thought about sorting the table alphabetically and then splitting it in two, but that doesn't seem to make things easier for me. Do you have any suggestions?
I have a table user and one message. In message I should have
receiver_id. From what I know, I can't make them both foreign keys for user, so I have to pick one of them. Doesn't this, however, lead to data inconsistency(which, as far as I know, is bad)? What is the right approach here?
I do not think that it matters, but I use MySQL 5.5.