List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 26 2001 2:00am
Subject:Re: Question on design
View as plain text  
At 7:53 PM -0600 7/25/01, David Lott wrote:
>(please reply directly)
>
>
>I'm new to mysql and I'm working on a design for an application that 
>will require a LOT of lookups on IP addresses.  Data set is on the 
>order of millions of addresses.  In my reading, I have not 
>encountered a TYPE of ip_address or some such.  Did I miss it?

No.  There's no such type in MySQL.

>
>If there is no such type, what would be the best way to setup the 
>addressing for the fastest possible locate? 
>Use varchar (15) and put the whole address in?
>Use 4 fields A, B, C & D all as tinyint to represent A.B.C.D?

Or convert the address to a 32-bit integer and store it in an INT column.
If you use separate columns, there are probably network mask operations and
such that you'll find more difficult to do than if you store the address
in a single column.  Depends on what kind of things you want to do with the
addresses.

>
>My assumption is that an integer search would be faster than a text 
>search - am I correct?

A 4-byte integer like INT would certainly be faster than a 15-char string.

>What works best?  How would you tackle this?
>
>
>
>Thanks,
>David Lott


-- 
Paul DuBois, paul@stripped
Thread
Question on designDavid Lott26 Jul
  • Re: Question on designPaul DuBois26 Jul
  • Re: Question on designryc26 Jul