MySQL Forums
Forum List  »  General

Multiple complex queries
Posted by: Malcolm Rook
Date: December 03, 2009 05:14AM

I am in the process of moving from SQL Server 2005 to MySQL.
I have a database of weather data (5 temperatures, pressure, humidity, light level and 4 wind speed and direction parameters) which is logged every minute. (The SQL database table currently has over 2 million entries, indexed on the reading date/time).
When querying the table for display, the timescale can be 6, 12 or 24 hours or week, month or year. The data needs to be averaged or summed for various periods to give 360 values along the time axis.
I can get the data by issuing a query for each time slot to return the avreaged/summed data but this means issuing 360 queries and is slow, taking about 30 seconds to complete.
Does anyone know of a more elegant, and faster, way to achieve this?

Options: ReplyQuote

Written By
Multiple complex queries
December 03, 2009 05:14AM
December 03, 2009 09:02AM
December 04, 2009 10:50PM
December 07, 2009 04:16AM
December 07, 2009 10:37AM
December 07, 2009 12:27PM

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.