Re: match an IP address - Mailing list pgsql-general

From Phoenix Kiula
Subject Re: match an IP address
Date
Msg-id e373d31e0809221726u55ae750dw69ecafb2b450b3e2@mail.gmail.com
Whole thread Raw
In response to match an IP address  (Joao Ferreira gmail <joao.miguel.c.ferreira@gmail.com>)
List pgsql-general
> > I think this is common DB design on many websites that have registered
 > > user IDs.
 > >
 >
 >  Is it? Name one! Sounds like crappy design to me.
 >




It might sound crappy design to you, but for websites that allow users
 to do something while they are registered OR unregistered, will choose
 to have this for query speed. (Registered user goes in as "testuser"
 while an unregistered one goes as his IP address--some websites also
 use cookies but they're less reliable.)

 We can make this very relationally sound and whatnot, but having one
 field to go to, whether you are registered or not, makes it much
 simpler.

 Most websites have to allow for dots in their user ID these days as
 people prefer to have their email address as user ID. Which means that
 the dot checking of an IP address may not work to distinguish IP
 addresses (unregistered user) from registered user IDs.

 In this scenario, for query speed, again, if there is a column that
 tells us whether this user is registered or not it helps a great deal.
 The INET match condition is not good enough for speed for most modern
 websites with any sizeable traffic. I even wrote a function that
 converts IP to INET integer and vice versa, but no great boost in
 query speed that could compare to an indexed query on user_id and
 user_reg.

 Welcome your thoughts on how you would do it.

pgsql-general by date:

Previous
From: Tino Wildenhain
Date:
Subject: Re: match an IP address
Next
From: "Dale Harris"
Date:
Subject: Re: Triggers not working