I'm using django-geoip==0.3 in production and notice strange behavior of PostgreSQL 9.1, when executing queries:
SELECT relname, idx_scan, seq_scan, 100 * idx_scan / (seq_scan + idx_scan) "index_used, %", n_live_tup rows_in_table FROM pg_stat_user_tables WHERE seq_scan + idx_scan > 0 ORDER BY n_live_tup DESC;
relname | idx_scan | seq_scan | index_used, % | rows_in_table
----------------------------------+----------+----------+---------------+---------------
django_geoip_iprange | 5323362 | 4830742 | 52 | 160320
django_geoip_city | 8258720 | 185 | 99 | 990
django_geoip_country | 164658 | 2780330 | 5 | 252
django_geoip_region | 44712 | 749790 | 5 | 110
52% of queries generates sequential scans, this leads to long execution time. Currently, I have 15ms in average for those types of queries which is way too long.
I tinkered a bit with you code and reduced the problem to this Stackoverflow question. Do you have thoughts about this issue?
I'm using
django-geoip==0.3in production and notice strange behavior of PostgreSQL 9.1, when executing queries:52% of queries generates sequential scans, this leads to long execution time. Currently, I have 15ms in average for those types of queries which is way too long.
I tinkered a bit with you code and reduced the problem to this Stackoverflow question. Do you have thoughts about this issue?