The new InstanceUser model has instance as a foreign key. Should I index
that?

Also, the Instance model has
```
    boundaries = models.ManyToManyField('Boundary', null=True, blank=True)
```

That creates a join table with instance as a foreign key. If we want to
index that we'll presumably need to use "through" and create
InstanceBoundaries explicitly.





On Wed, Aug 7, 2013 at 3:20 PM, Justin Walgran <notifications@github.com>wrote:

> In opentreemap/treemap/audit.py:
>
> > @@ -592,9 +592,11 @@ def current_value(self):
> >  # Test null values
> >  ###
> >  class Audit(models.Model):
> > -    model = models.CharField(max_length=255, null=True)
> > -    model_id = models.IntegerField(null=True)
> > -    instance = models.ForeignKey('Instance', null=True, blank=True)
> > +    model = models.CharField(max_length=255, null=True, db_index=True)
> > +    model_id = models.IntegerField(null=True, db_index=True)
> > +    instance = models.ForeignKey(
> > +        'Instance', null=True, blank=True, db_index=True)
>
> We should have an index on instance whenever it is a foreign key. Is this
> the only one that was missing?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/azavea/OTM2/pull/157/files#r5640753>
> .
>



-- 
Rick Mohr, Software Developer

Azavea |  340 N 12th St, Ste 402, Philadelphia, PA
rmohr@azavea.com  | T 215.701.7504  | F 215.925.2663
Web azavea.com <http://www.azavea.com/>  |  Blog
azavea.com/blogs<http://www.azavea.com/Blogs>
| Twitter @azavea <http://twitter.com/azavea>