3
I have a system that holds more than 2000 clients and it keeps increasing, and every time they do a search, they call mysql with more than 20,000 items (and this number also continues to increase), it would be possible for me to have a cache or to do something so that it doesn’t need to always search?
I was thinking of making a system that the most searched word creates a file on the server with the first 20,30 searches, would be right?
Right and wrong goes according to need, I have a server running redis to "hold" relational database queries (mariadb) for X time. Do you use Varnish or something? How do clients access this mysql data by direct connection? Have you ever thought about providing an API?
– rzani
I believe that the ideal is to cache the result of the query, Mysql has the
Query Cache, but... This will only get the data from the cache (instead of "fetch again") if theWHEREis identical and also does not have INSERT/UPDATE in the table. It is unlikely to solve, but if you have a table that is not constantly updated (that is, there is a lot of read and write) and does not haveWHEREspecific (for example, for each user connected to the site), theQuery Cachecan be an alternative and easy to implement.– Inkeliz
@rzani I don’t use Varnish or anything like that, I only use mysql and php for back-end and answer in json for his mobile.
– Kol
@Inkeliz would not be feasible to the database is always updating, even more in this application beginning.
– Kol