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 save to the bank and select recipes from that data
You will have a field with the primary key of the table ( id
), two with the foreign keys of the user ( id_usuario
) and the recipe ( id_receita
), / p>
1.1. Have a quantity column and always add one more when the user sees a recipe.
This is an efficient way, but it is not more complete, since the only information stored will be how often the user accessed what revenue, even if they added a date field it will save only the last time a particular user accessed a particular recipe
1.2. Save each access on a different line and to know that amount use COUNT()
grouping per user and revenue
This is a more costly method (more data to store), but this allows you to save more data that may be useful, for example, you can save the location where the recipe was accessed and from there suggest typical recipes local
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 to% with% of those with a given characteristic or% with% if you do not have
3. The least expensive form for the bank (less data to be saved, in this case none) is to suggest revenue from the current revenue, so if the user is seeing a revenue X, will be shown for it recipes with characteristics similar to X
IMPORTANT: Do not worry so much about performance, you do not need to fetch all the database data immediately, initially only search the revenue that the user is viewing and then, through AJAX, / p>
Evaluate what you want with your application, whether you really need to be so careful with a "heavy" bank and then choose what you think is the best