List:General Discussion« Previous MessageNext Message »
From:Jan Steinman Date:August 10 2011 6:19pm
Subject:Re: Query Optimization
View as plain text  
> From: Brandon Phelps <bphelps@stripped>
> 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`.

> 	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
> 	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 ::::

Query OptimizationBrandon Phelps10 Aug
  • Re: Query OptimizationPeter Brawley10 Aug
Re: Query OptimizationBrandon Phelps10 Aug
Re: Query OptimizationJan Steinman10 Aug