jamoraquai
Programmer
Hi guys!!!
Any idea how i can optimize this sql query?
select (sum(ac1.insertions) + sum(ac2.insertions) + sum(ac3.insertions)) as insertions, ac1.time_stamp from ac1, ac2, ac3 where ac1.time_stamp = ac2.time_stamp and ac2.time_stamp = ac3.time_stamp and ac1.time_stamp between '07/22/2003 09:00:00' and '07/22/2003 16:00:00'group by ac1.time_stamp;
result:
insertions | time_stamp
------------+-------------------------
1200 | 07/22/2003 09:03:00 HKT
1350 | 07/22/2003 09:04:00 HKT
1500 | 07/22/2003 09:05:00 HKT
1650 | 07/22/2003 09:06:00 HKT
1800 | 07/22/2003 09:07:00 HKT
1950 | 07/22/2003 09:08:00 HKT
2100 | 07/22/2003 09:09:00 HKT
:
:
:
Thanks in advance everyone. hope you can help me with this coz the query really takes a long time to process....
Any idea how i can optimize this sql query?
select (sum(ac1.insertions) + sum(ac2.insertions) + sum(ac3.insertions)) as insertions, ac1.time_stamp from ac1, ac2, ac3 where ac1.time_stamp = ac2.time_stamp and ac2.time_stamp = ac3.time_stamp and ac1.time_stamp between '07/22/2003 09:00:00' and '07/22/2003 16:00:00'group by ac1.time_stamp;
result:
insertions | time_stamp
------------+-------------------------
1200 | 07/22/2003 09:03:00 HKT
1350 | 07/22/2003 09:04:00 HKT
1500 | 07/22/2003 09:05:00 HKT
1650 | 07/22/2003 09:06:00 HKT
1800 | 07/22/2003 09:07:00 HKT
1950 | 07/22/2003 09:08:00 HKT
2100 | 07/22/2003 09:09:00 HKT
:
:
:
Thanks in advance everyone. hope you can help me with this coz the query really takes a long time to process....