Analyzing what you want...
Suggest recipes for the user
There are several ways to do this:
1. Know which user accessed which recipe and how many times to store in the database and select recipes from this data
You will have a field with the table primary key (id
), two with the user’s foreign keys (id_usuario
) and revenue (id_receita
), you have some ways of knowing that amount:
1.1. Have an amount column and always add one more when the user sees a recipe.
This is an efficient way, but is no longer complete, since the only information saved will be how many times the user accessed which recipe, even if added a date field it will save only the last time a particular user accessed a particular recipe
1.2. Store each access in a different row and to know that amount use the COUNT()
grouping by user and recipe
It is a more expensive method (more data to store), but this allowed you to store more data that may be useful, for example, you can save the location where the revenue was accessed and from there suggest recipes typical of that location
2. You can also create a form where the user specifies their preferences
In this case I suggest the creation of several columns: lactose, sweet, salty, nutritious etc. and set as TRUE
those which have a particular characteristic or FALSE
if you don’t have
3. The least expensive way for the database (less data to be saved, in this case, none) is to suggest recipes from the current recipe, so if the user is seeing an X recipe, recipes with characteristics similar to X will be shown to him
IMPORTANT: Do not worry so much about performance, it is not necessary to fetch all the data from the database immediately, search initially only the revenue that the user is viewing and then, through AJAX, search for other
Evaluate what you want with your application, if it is really necessary to be so careful with a "heavy" bench and then choose what you believe to be the best
What do you consider "heavy"? how many lines?
– user60252
so what I don’t know, I’m still beginner in mysql, qts line starts to get mt heavy?
– Leandro Marzullo
How many lines do you think your bank might have? Kicks
– user60252
I hope thousands...rs, but whatever number I pass here is a kick, have some line number that can already be considered too much?
– Leandro Marzullo
Yeah, I don’t know, either, but I have a 15MB chart and the appointments are instantaneous. In the table there are 7400 lines with lyrics of songs, if I make a select with
a
returns all records instantly– user60252
But to optimize the query of a read in this post https://www.profissionaisti.com.br/2011/09/indices-mysql-augmented/
– user60252