MySQL Forums
Forum List  »  Newbie

Re: SQL code optimization
Posted by: Phillip Ward
Date: September 02, 2015 05:27AM

Quote

My issue here is that I store an entry every 2 minutes, which means there is too much data to deal with when 7 days are displayed.

But 5040 points on a graph gets unnecessarily busy.
So this is only a User Interface issue? How disappointing ;-)

Just because you store your data every 2 minutes doesn't necessarily mean that you have to display it that way.
Look into the "group by" clause and Aggregate functions, e.g. Average(), and apply these to your data, grouping by whatever Temporal unit (e.g. hours) you choose to display. OK, the query will look a bit heavyweight and may run a little slower, having to do the extra work, rolling all those values together, but it should get you what you need.

Alternatively, just retrieve the raw data and process them further at the application end. YMMV.

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
August 31, 2015 10:51AM
August 31, 2015 11:41AM
August 31, 2015 04:56PM
August 31, 2015 10:10PM
September 01, 2015 07:24PM
Re: SQL code optimization
September 02, 2015 05:27AM
September 02, 2015 10:01AM
September 01, 2015 05:27AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.