Opened 13 years ago

Closed 13 years ago

#17245 closed Bug (duplicate)

IpAddressField not stored effeciently

Reported by: harm Owned by: nobody
Component: Database layer (models, ORM) Version:
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django stores IpAddressField as a string: (mysql `ip_joined` char(15) DEFAULT NULL, )
This is not effecient, and in cases where you have a LOT of these this hurts.

Django should use an INT UNSIGNED column instead of char(15). This saves 73% storage.
(difference between a 32GB ram VPS or a 8GB VPS)

mysql provides some nice helpers for this:

mysql> SELECT INET_ATON('10.0.5.9');
        -> 167773449

ref: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_inet-aton

Change History (1)

comment:1 by Aymeric Augustin, 13 years ago

Resolution: duplicate
Status: newclosed

See #326.

Note: See TracTickets for help on using tickets.
Back to Top