Re: Storing IP address as integer within database to remove need for full text search

2011-07-19 Thread Daniel Swarbrick
On Jul 19, 2:16 pm, "Cal Leeming [Simplicity Media Ltd]" wrote: > If I was to continue using MySQL for ipv6 storage, I'd probably create a > table with a column for each byte, convert to an int, and apply a unique > index to them all. I think MySQL supports 64 bit ints, so you could split an ipv6

Re: Storing IP address as integer within database to remove need for full text search

2011-07-19 Thread Cal Leeming [Simplicity Media Ltd]
On Tue, Jul 19, 2011 at 1:02 PM, Daniel Swarbrick < daniel.swarbr...@gmail.com> wrote: > The snippet seems to have been removed (returns "page not found"). Wtf? :X http://djangosnippets.org/snippets/ Looks like they have suffered some sort of data loss.. I'm seeing only snippets from 2 weeks a

Re: Storing IP address as integer within database to remove need for full text search

2011-07-19 Thread Daniel Swarbrick
The snippet seems to have been removed (returns "page not found"). I was curious to have a look at how you were handling this. For sure, Postgres has native support for ipv4 and ipv6 address storage. AFAIK, MySQL does not... although could store an ipv4 address in a 32-bit unsigned int field. I don

Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Jul 18, 2011 at 4:36 PM, Tom Evans wrote: > On Mon, Jul 18, 2011 at 3:56 PM, Cal Leeming [Simplicity Media Ltd] > wrote: > > Hi, > > I have created a ModelField called RealIPAddressField. > > It stores the IP address in integer form, meaning the lookups on large > > tables are much faste

Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Tom Evans
On Mon, Jul 18, 2011 at 3:56 PM, Cal Leeming [Simplicity Media Ltd] wrote: > Hi, > I have created a ModelField called RealIPAddressField. > It stores the IP address in integer form, meaning the lookups on large > tables are much faster: > http://djangosnippets.org/snippets/2493/ > @django-develope

Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Thansk for your re 2011/7/18 Łukasz Rekucki > On 18 July 2011 16:56, Cal Leeming [Simplicity Media Ltd] > wrote: > > Hi, > > I have created a ModelField called RealIPAddressField. > > It stores the IP address in integer form, meaning the lookups on large > > tables are much faster: > > http://d

Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Dmitry Gladkov
I like the idea, but I don't like the approach, it should be a subclass of PositiveIntegerField, as it is an unsigned int on DB level. Also, I agree with Łukasz that it should support both IPv6 and IPv4. -- Best wishes, Dmitry Gladkov, mailto:dmitry.glad...@gmail.com +380 91 303-37-46 On Mon,

Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Łukasz Rekucki
On 18 July 2011 16:56, Cal Leeming [Simplicity Media Ltd] wrote: > Hi, > I have created a ModelField called RealIPAddressField. > It stores the IP address in integer form, meaning the lookups on large > tables are much faster: > http://djangosnippets.org/snippets/2493/ > @django-developers - Do yo

Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Javier Guerra Giraldez
On Mon, Jul 18, 2011 at 10:13 AM, Javier Guerra Giraldez wrote: > On Mon, Jul 18, 2011 at 9:56 AM, Cal Leeming [Simplicity Media Ltd] > wrote: >> It stores the IP address in integer form, meaning the lookups on large >> tables are much faster: > > are they?    hashtables shouldn't be too sensitiv

Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Or maybe you were talking about hash tables in MySQL. Either way, you're right that this would probably need some benchmarks before being approved for the core. @django-developers, if I was to provide some benchmarks, would this possibly be considered for the core? Cal On Mon, Jul 18, 2011 at 4

Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Sorry, I should have been a little more specific. I meant faster lookups in terms of database index, such as MySQL with InnoDB. Cal On Mon, Jul 18, 2011 at 4:13 PM, Javier Guerra Giraldez wrote: > On Mon, Jul 18, 2011 at 9:56 AM, Cal Leeming [Simplicity Media Ltd] > wrote: > > It stores the IP

Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Javier Guerra Giraldez
On Mon, Jul 18, 2011 at 9:56 AM, Cal Leeming [Simplicity Media Ltd] wrote: > It stores the IP address in integer form, meaning the lookups on large > tables are much faster: are they?hashtables shouldn't be too sensitive to key size, as long as the string size stays bounded... like on IP addr

Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Cal Leeming [Simplicity Media Ltd]
Hi, I have created a ModelField called RealIPAddressField. It stores the IP address in integer form, meaning the lookups on large tables are much faster: http://djangosnippets.org/snippets/2493/ @django-developers - Do you think there is any possibility of this getting included into the core?