I've been asked to make some reports recently for some people in
my company.Almost all of them are quite heavy and hit the
database pretty hard.The thing is that these reports are usually
generated once or twice a month, but they process a year's worth
of data. Every time they are generated, they really upsets my
poor production MySQL database.
I was thinking if there maybe could be a better way to just save
the processed data in a table and update it every now and
then.
So.. this is what I did:
- I created a table that keeps the aggregated results from the
report.
- I added to the start of the SQL statement "INSERT INTO reports.thistable SELECT (the
worlds most intensive SQL query) ;"
- At this point I realised that I need a bit extra help determining which parts of the data should be updated and …