I have a message
table that contains the message itself. I am not sure whether I should separate these two, and what the benefits are, if there are any.
CREATE TABLE message (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
thread_id INT UNSIGNED NOT NULL,
message TEXT NOT NULL,
is_viewed BOOL NOT NULL
);
Should I normalize it further like this?
CREATE TABLE user_sent_message (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
message_id INT UNSIGNED NOT NULL,
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
thread_id INT UNSIGNED NOT NULL,
is_viewed BOOL NOT NULL
);
CREATE TABLE message (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
message TEXT NOT NULL
);
Does that not make the queries more complex? And what are the benefits of doing this if there are any benefits? I understand the table size of the first alternative will be much less and distributed among the two tables in second alternative. Will this affect performance when doing queries or memory usage?