Re: ip range lookup

2003-10-04 Thread Jose Miguel
gt; Sent: Sunday, October 05, 2003 1:08 AM Subject: ip range lookup > I have a table that maps ip-ranges to countries: each record consists of 2 > ip numbers (unsigned int's) and the country in which all ip's between those > two are located. > How should I setup the table t

Re: ip range lookup

2003-10-04 Thread Matt W
Hi Willem, I don't *think* MySQL optimizes BETWEEN like that to use an index. Have you tried this?: SELECT * FROM ipcountry WHERE ip1 >= 123456789 AND ip2 <= 123456789; Matt - Original Message - From: "Willem Bison" Sent: Saturday, October 04, 2003 6:08 PM Sub

ip range lookup

2003-10-04 Thread Willem Bison
I have a table that maps ip-ranges to countries: each record consists of 2 ip numbers (unsigned int's) and the country in which all ip's between those two are located. How should I setup the table to have fast ip lookups ? Making a primary key of the 2 ip's and doing a 'select .. between ip1 and ip