MYSQL
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives Mailing Lists MYSQL

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old June 27th, 2008, 08:31 AM
Darryl Steyn
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Slow Query

Hi,

I am running a query that I feel shouldn't be taking as long as it does to
execute. The query is as follows;

SELECT traffic.trafficin.bytes_in as bytes_in,
round() as serverallkbytes_in,
cache.server.tstamp as tstamp FRM traffic.trafficin LEFT JIN cache.server
N(from_unixtime(traffic.trafficin.time,"%Y %M %d %H
%i")=date_format(cache.server.tstamp,"%Y %M %d %H %i")) WHERE (
traffic.trafficin.name="em0" AND cache.server.tstamp 0) AND
((date_format(cache.server.tstamp,'%Y-%m-%d') BETWEEN "2008-05-31" AND
"2008-06-10" ))

Here's the output from the explain;


| id | select_type | table | type | possible_keys | key |
key_len | ref | rows | Extra |

| 1 | SIMPLE | server | range | PRIMARY | PRIMARY | 4
| NULL | 3952 | Using where |
| 1 | SIMPLE | trafficin | ref | namekey,nameindex | namekey |
30 | const | 25867 | Using where |


The strange thing is, when I remove the date range the query executes in an
acceptable time. Can anyone maybe point me in the right direction?

Thanks,
Darryl

Reply With Quote
Reply

Viewing: Web Development Archives Mailing Lists MYSQL > Slow Query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT