List:General Discussion« Previous MessageNext Message »
From:Dan Rossi Date:April 4 2003 7:09am
Subject:RE: MySQL index fun
View as plain text  
Create a compound index on either (time, source_ip) or (source_ip,
time).  Mysql cannot use two indexes on one table.

woah what are you saying here , that it cant have multiple indexes within a
table ?

and what is a compound index ?

say i have a table

products:
productID
product
storeID <-index
userID <-index

stores:
storeID
store

users:
userID
user

can i not have multiple indexes like that , as i usually use int keys to
join tables together



-----Original Message-----
From: Dan Nelson [mailto:dnelson@stripped]
Sent: Friday, April 04, 2003 3:22 PM
To: Steve Phillips
Cc: mysql@stripped
Subject: Re: MySQL index fun


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

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

Thread
MySQL index funSteve Phillips4 Apr
  • Re: MySQL index funDan Nelson4 Apr
    • RE: MySQL index funDan Rossi4 Apr
      • Re: MySQL index funDan Nelson4 Apr