I'm creating a chart to analyze the age-appropriate posts access by time on my site. But the site does not yet have this ability to capture user activity and need to do it.
My task and change the database so that it is possible, I currently have the following tables:
table user{
id_user (Chave Primaria);
date_of_birth (date);
name (char(255))
}
table post{
id_post (Chave Primaria);
title (char(255))
}
When a user 'Tobias' accesses the 'How to bake an egg' posts on '23 May 2018 'for '30 seconds', I will need to have this information in the database. p>
First I thought of creating a table as intuitively as possible:
table acesso{
id_acesso(Chave primaria);
id_user (Chave estrangeira);
id_post(Chave estrangeira);
date (timestamp);
duration (inteiro, segundos);
}
But I do not know what is the most efficient way to do this table or if there is a better one or if I'm doing the right thing. Well I'm planning this bank to have thousands of users and posts, and efficiency is something I want.