IP2Location suggesting to use DECIMAL(39, 0) for IPs

121 views Asked by At

I'd like to store ip2location database in a postgres database.

Guide on ip2location website suggests to store IP addresses that specify the range (ip_from and ip_to) in columns of type DECIMAL(39, 0).

I would have expected this to be of type INET.

Is there any advantage (e.g. in terms of speed, size, ...) to use DECIMAL(39, 0) instead of INET? Other than the ip2location database format contains IPs converted to integers already and one would have to convert that back to IP addresses obviously.

1

There are 1 answers

2
Laurenz Albe On

The advantage of using the inet data type are

There is no advantage in using NUMERIC(39), except that it seems to be required by the software you want to use.