As IPV6 needs 128 bits(16 bytes) then why in postgres CIDR datatype has storage as 24 byte(8.1) and 19byte(9.1)?

Viewed 1789

i am working with ipv4 and ipv6 to store in postgres db.

as ipv4 needs 32 bits(4byte) and ipv6 needs 128(16byte) bits.then why in postgres CIDR and INET datatype has the storage as 12 byte and 24 bytes respectively for IPV4 and IPV6(8.1).

with 9.1,it has 7 byte and 19 byte respectively for IPV4 and IPV6.

i don't understand why it needs extra byte more than 16 byte for storing IPV6 and 4 byte for IPV4??

http://www.postgresql.org/docs/8.1/static/datatype-net-types.html

http://www.postgresql.org/docs/9.1/interactive/datatype-net-types.html

1 Answers
Related