This is something that I'd also be interested in. For the Google App Engine 
backend, you have the ability to create indexes that require more 
configuration than just on/off. But I don't think a single additional field 
would do the trick for my case.

Another option would be to open up the Meta class for custom attributes. 
There's a thread which discusses this here:

https://groups.google.com/forum/#!topic/django-developers/JEDJYB41LGI

The config might look something like this:

class Article(db.models):
  class Meta:
    custom_indexes = {'field1': 'hash', 'field2': 'btree'}
 field1 = db.IntegerField()
 field2 = db.CharField() 

The tradeoff would be that the index would not be specified in the field 
description, but it would be close enough. (Currently for the app engine 
backend, you specify these in a separate file that the backend looks for.)

On Monday, September 23, 2013 10:36:56 AM UTC-4, Zev Benjamin wrote:
>
> Hi,
>
> I'd like to be able to specify what kind of index the database should use 
> for a particular field.  I have a proof of concept branch that works with 
> PostgreSQL at https://github.com/zbenjamin/django/compare/index-types, 
> but I'd like to solicit opinions on whether there's a better way of doing 
> it.  The way it works in my branch is that you specify the index type by 
> making the Field db_index argument a string containing the name of the 
> index type you'd like to use.  Specifying db_index=True uses the default 
> index type.
>
> Example usage:
>
> class IndexTest(models.Model):
>     unindexed = models.IntegerField(db_index=False)
>     default_indexed = models.IntegerField(db_index=True)
>     btree_indexed = models.IntegerField(db_index="btree")
>     hash_indexed = models.IntegerField(db_index="hash")
>
>
>
> Zev
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/ac38c2ab-566f-4212-8eba-244f3a074851%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to