Re: [GENERAL] IPv4 addresses, unsigned integers, space

2003-07-17 Thread Florian Weimer
Jim Crate <[EMAIL PROTECTED]> writes:

> on 7/15/03, Florian Weimer <[EMAIL PROTECTED]> wrote:
>
>>If I switched from signed integers to unsigned integers (and from INET
>>to "real" IPv4 addresses, consisting of the relevant 32 bits only) I
>>think I could save about 25% of my table size.
>
> Why do you need unsigned ints to hold IP addresses?

This is a misunderstanding.  I could use both space-conservative IP
addresses and unsigned integers.

> What difference does it make if IP addresses with a class A higher
> than 127 appear as negative numbers?

The mapping does not preserve ordering if not done carefully.

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [GENERAL] IPv4 addresses, unsigned integers, space

2003-07-15 Thread Florian Weimer
Bruno Wolff III <[EMAIL PROTECTED]> writes:

>> Does PostgreSQL already implement these data types?  I don't think so.
>> If I succeed in implementing them, would you accept a patch?
>
> You can have unsigned integers using a domain with a check constraint.

They take twice as much storage as necessary.

---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org


Re: [GENERAL] IPv4 addresses, unsigned integers, space

2003-07-15 Thread Bruno Wolff III
On Tue, Jul 15, 2003 at 12:59:34 +0200,
  Florian Weimer <[EMAIL PROTECTED]> wrote:
> If I switched from signed integers to unsigned integers (and from INET
> to "real" IPv4 addresses, consisting of the relevant 32 bits only) I
> think I could save about 25% of my table size.
> 
> Does PostgreSQL already implement these data types?  I don't think so.
> If I succeed in implementing them, would you accept a patch?

You can have unsigned integers using a domain with a check constraint.

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match