Skip to main content
1 of 5
vashavoc
  • 183
  • 1
  • 4

MYSQL query speed (or lack there of)

I have a MySQL database running on an Ubuntu box that pings 250 clients once a minute (24x7). My col names are ip_address [varchar(16)], status[varchar(7)], timestamp(datetime).

Been running it for several weeks and its grown (10,581,421+ rows). I run a query to return the most recent 800 results on a specific ip address:

"SELECT * FROM (SELECT Device_ip,Status,timestamp  FROM ping_results where Device_ip = '192.168.1.1' order by timestamp desc LIMIT 800)SUB ORDER BY timestamp asc"

It takes 10+ seconds to return the results. Is there anything I can do differently to speed this up?

vashavoc
  • 183
  • 1
  • 4