From: Dan Nelson Date: April 4 2003 5:22am Subject: Re: MySQL index fun List-Archive: http://lists.mysql.com/mysql/136440 Message-Id: <20030404052227.GR3344@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In the last episode (Apr 03), Steve Phillips said: > I have a table for ip data that i need to index to suit the following > query > > SELECT time,source_ip,bytes FROM data.tb_ipdata_0403 WHERE (time > > 1049108400 AND time < 1051786799) AND (source_ip > 3389268097 AND > source_ip < 3389268099) > > if i created an index on the time column and an index of the > source_ip column would the query then use these indexes or would i > need to change my query ? Create a compound index on either (time, source_ip) or (source_ip, time). Mysql cannot use two indexes on one table. -- Dan Nelson dnelson@stripped