mysql - Post Type in Database - INT or VARCHAR -


I am creating a forum type of site that will contain different types of posts: discussion, question and comment.

What would be considered the preferred method of storage for both performance and readability?

For example:

  id | Post type | Post Title 1 2 Example Title   

or

  id | Post type | PostTitle 1 question example title   

Performance is my main goal, so my first idea was to store it as an INT. However, to get the post type name (which I need every time) I have run another incredibly if / else statement.

I would like the type of VARCHAR because it is / if avoiding other business and remnants are readable, but I have uncertainty.

If you almost always need a text version of the post type, you can add additional tables and additional code To avoid, it is possible to use VARCHAR type.

Comments