As proposed by timgraham in https://code.djangoproject.com/ticket/24507 I 
open the discussion here.

When adding db_index=True on a CharField Django automatically create 2 
indexes on some backends as PostgreSQL. But in usage the second index is 
not always necessary if you never use contains() or similar queries. As you 
can see here I extracted indexes usages statistics from one of our 
production server.

The index *foo_bar_email_from_create_like* is never use even if 
*foo_bar_email_from_create* is, and if we look on our queries this is 
totally logic and regular. And it's the same for *foo_bar_tech_id* and 
*foo_bar_user_type*, and it's the same on the other table.

        indexrelname                  |  idx_scan  | idx_tup_read | 
idx_tup_fetch
--------------------------------------+------------+--------------+--------------
foo_bar_address_like                  |          0 |            0 |         
    0
foo_bar_current_profile_id            |       1846 |          617 |         
  236
foo_bar_date_delete                   |          0 |            0 |         
    0
foo_bar_email_from_create             |      31209 |        90886 |         
21903
foo_bar_email_from_create_like        |          0 |            0 |         
    0 
foo_bar_entity_id                     |       8026 |        28957 |         
   14
foo_bar_pkey                          | 1258565593 |   1418841848 |    
1194873240
foo_bar_site_id                       |    4495829 |  51000840065 |         
 3564
foo_bar_tech_id                       |   25045160 |     28233693 |      
25087324
foo_bar_tech_id_like                  |          0 |            0 |         
    0
foo_bar_user_type                     |      21428 |    263769329 |     
216686751
foo_bar_user_type_like                |          0 |            0 |         
    0
foo_bar_uuid_like                     |          0 |            0 |         
    0
foo_bar_uuid_uniq                     |   13134415 |     13157636 |      
12928178 

A last point is each index on this table is consumming more the 2Gb on disk.

Even if we can suppress the indexes, and this is what we do with 
(https://github.com/novafloss/django-json-dbindex) on bigger one realy 
problematic, we'd prefer to not create them.

Thanks for your time and this wonderful project Django is.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/9b08fa88-a03f-415f-9eb3-6a71e379df7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to