Sunday, 8 September 2013

Reduce MySQL queries by saving result to textfile

Reduce MySQL queries by saving result to textfile

I have an app that is posting data from android to some MySQL-tables
through PHP with a 10 second interval. The same PHP-file does a lot of
queries on some other tables in the same database and the result is
downloaded and processed in the app (with DownloadWebPageTask). I usually
have between 20 and 30 clients connected this way. Most of the data each
client query for is the same as for all the other clients. If 30 clients
run the same query every 10th second, 180 queries will be run. In fact
every client run several queies, some of them are run in a loop (looping
through results of another query).
My question is: if I somehow produce a textfile containing the same data,
and updating this textfile every x seconds, and let all the clients read
this file instead of running the queries themself - is it a better
approach? will it reduce serverload?

No comments:

Post a Comment