> From: Brandon Phelps <bphe...@gls.com>
> 
> I am curious if there is any way I can better optimize the below query, as 
> currently it takes this query around 10 seconds to run but I am sure this 
> will get slower and slower as the database grows.

You need an index on `close_dt`.

> SELECT
>       open_dt,
>       close_dt,
>       protocol,
>       INET_NTOA(src_address) AS src_address,
>       src_port,
>       INET_NTOA(dst_address) AS dst_address,
>       dst_port,
>       sent,
>       rcvd
> FROM connections
> WHERE
>       dst_port = 80
> ORDER BY close_dt  DESC
> LIMIT 0, 30

----------------
Current farmers, who have become mere operators of machines and mixers of 
chemicals, may not have the skills to develop a local, sustainable agriculture. 
A new generation of farmers, numbering in the tens of millions, will need to be 
trained and relocated to rural communities. -- Pat Murphy
:::: Jan Steinman, EcoReality Co-op ::::


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to