Do you have the tables in the FROM listed in descending order of size?

> -----Original Message-----
> From: Jake Skinner [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 19, 2004 1:40 AM
> To: [EMAIL PROTECTED]
> Subject: [sqlite] some optimisation help?
> 
> 
> The following query is very slow. I don't know how to improve my query, 
> and I'm sure I'm doing this just about the slowest way possible!! :(
> 
> begin sql query
> ======================
> select t1.time, t1.units_processed,
> round((t1.units_processed+t2.units_processed+t3.units_processed+t4
> .units_processed)/4) 
> as ave
> from location_stats as t1,
> location_stats as t2,
> location_stats as t3,
> location_stats as t4
> where t1.time=t2.time
> and t3.time=t4.time
> and t4.time=t2.time
> and t1.date=date("2004-02-24",'-7 days')
> and t2.date=date("2004-02-24",'-14 days')
> and t3.date=date("2004-02-24",'-28 days')
> and t4.date=date("2004-02-24",'-35 days')
> =======================
> end sql query
> 
> If anyone has any sort of suggestions I would be very greatful...
> 
> cheers
> Jake
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to