I’m designing an answer question site. Previously i create two tables: posts and answers. Is it okay (execution time query) to merge those table into one ‘posts’ since there’s similarity in the fields like vote_up,down,flag an so on.
Thanks for the feedback guys, this is the table
CREATE TABLE IF NOT EXISTS 'posts' (
'id' int(10) unsigned NOT NULL AUTO_INCREMENT,
'date_created' datetime NOT NULL,
'date_edited' datetime DEFAULT NULL,
'post_type' tinyint(1) DEFAULT NULL,
'parent' int(10) unsigned DEFAULT NULL,
'user' int(10) unsigned NOT NULL,
'title' varchar(255) DEFAULT NULL,
'slug' varchar(255) DEFAULT NULL,
'content' text NOT NULL,
'post_status' tinyint(1) DEFAULT NULL,
'vote_up' int(10) unsigned DEFAULT '0',
'vote_down' int(10) unsigned DEFAULT '0',
'answered' tinyint(1) DEFAULT NULL,
'flag' tinyint(1) DEFAULT NULL,
PRIMARY KEY ('id')
)
Sure, there’s no meaningful performance hit there. What some forum software does is it has a table for each topic, and a table for posts. When a new topic is created (your question), the post content is put in the post table, and the topic table is used for a title, an id, perhaps some categorization, and so on.