#11442: Postgresql backend casts inet types to text, breaks IP operations and
IPv6
lookups.
---------------------------------------------------+------------------------
Reporter: eide | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 1.0
Resolution: | Keywords: ipv6
postgres inet
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by [email protected]):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Not only will using HOST yield wrong results, there are also severe
performance implications to using the HOST function call in lookups, as it
fails to utilize indexes on INET type fields. See the following example:
{{{
nav=# select count(*) from arp;
count
---------
6391765
(1 row)
nav=# explain analyze select * from arp where ip = '2001:700::1';
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------
Index Scan using arp_ip_btree on arp (cost=0.00..905.80 rows=232
width=67) (actual time=0.021..0.021 rows=0 loops=1)
Index Cond: (ip = '2001:700::1'::inet)
Total runtime: 0.051 ms
(3 rows)
nav=# explain analyze select * from arp where HOST(ip) = '2001:700::1';
QUERY PLAN
-------------------------------------------------------------------------------------------------------------
Seq Scan on arp (cost=0.00..200239.38 rows=32911 width=67) (actual
time=9410.175..9410.175 rows=0 loops=1)
Filter: (host(ip) = '2001:700::1'::text)
Total runtime: 9410.196 ms
(3 rows)
nav=#
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/11442#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---