I'm doing an application in nodejs, where it is constantly necessary to consult information in the database, for example: name, description of items and etc ... A similar site would be netflix, which queries such information every time the user passes the mouse over a movie / series.
But I would like to know if it is better to make a request to the database every time the user moves the mouse, or when loading the site, save the whole database in a session and call that data when the user passes the mouse, in case I would be using socket.io to streamline the response, however I do not know if such a practice requires too much of the server. So the question remains:
- Make a single select in the database or store everything in a session?
or
- Send miscellaneous requests whenever needed (almost always)?