B
B
bleyz2014-01-21 11:29:21
Software design
bleyz, 2014-01-21 11:29:21

What is the best way to organize the project database architecture?

Let's say there is a site with blogs, each post can be like, which database structure will be more correct.
Conditions one user - one like.
There are two tables posts(id, content) and likes(id, id_post, id_user);
1 - Calculate using JOIN
2 - Add the likes field to the posts table and count and change its value with each like or unlike
I think the second option will be the most effective, I would like to know how professionals solve such seemingly small tasks.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmko, 2014-01-21
@dmko

likes(id, id_post, id_user);

so perhaps it will be better, but for these purposes I would put either addthis.com or sharethis.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question