There are microblog messages and related voices / emoticons, as in MySQL tables innoDB. There is a requirement for two types of pages:
(A) A listing page containing many microblogs along with its counts / emoticons is counted on one page (say 25).
eg.
BIG FULL REPORT
Not so funny content that should be funny. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus euismod, therefore, pellentesque ...... DETAILS ....
(3) like, (5) boring, (7) smiling
. + 24 Other posts on one page.
(B) Permanent link containing one microblog with detailed voting + vote count / emoticons.
BIG FULL REPORT
Not so funny content that should be funny. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus euismod, therefore, pellentesque. Quisque viverra adipiscing auctor. Mauris ut diam risus, in fermentum elit. Aliquam urna lectus, egestas sit amet cursus et, auctor ut elit. Nulla tempus suscitit nisi, nec condimentum dui fermentum non. In eget lacus mi, ut placerat nisi.
(You, Derp and 1 more ), (5) boring , (7) smiling
1st approach:
Table No. 1:
post_id | post_content | post_title | creation_time
Table # 2 for storing votes, likes, emoticons:
action_id | post_id | action_type | action_creator | creation_time
To display a message page or single entry. The first table is requested to receive messages, the second is requested to receive all actions associated with messages. Whenever a vote is taken, etc., a tab is inserted into the post_actions table.
Second approach:
Table No. 1:
post_id | post_content | post_title | creation_time | action_data
Where action_data could be something like { "likes" : 3,"smiles":4 ...}
Table No. 2:
action_id | post_id | action_type | action_creator | creation_time
To display the message page, only the first table is requested to receive messages and action data, to display individual messages with detailed actions, the second table is requested to get all the actions associated with messages. Whenever a vote is taken, etc., a tab is inserted into the post_actions table, and the action_data field of table No. 1 is updated to store the updated score.
Assuming there are 100K messages and 10x actions Ie 1 million or more actions are created. Benefits 2? Any shortcomings besides having to read, modify, and update JSON information? Is there anyway, when approach number 2 can be monitored and improved?
Adding additional information based on feedback:
- Python scripts will read, write data.
- MySQL database servers will be different from web servers.
- Entries due to post creation are low Ie 10,000 per day. But those due to actions can be higher, suggest a maximum of 50 entries per second due to actions such as voting, sympathy, emoticon.
- I take care of comparing performance and reading for both and getting a second approach, as well as in the future.