title: Django using PostgreSQL - duplicated indexes
body: <p>I'm using <code>Django</code> over <code>PostgreSQL</code>, and I'm having trouble understanding how to use indices correctly to achieve the best performance. This is an example Model:</p>
  <pre><code>class SomeObject(BaseAggModel):
      id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
      element = models.ForeignKey(Element, on_delete=models.PROTECT, db_index=True)
      city = models.ForeignKey(City, on_delete=models.PROTECT, db_index=True)
      date_created = models.DateTimeField(null=True)
  
      class Meta:
          unique_together = ('element', 'city', 'date_created')
          
          indexes = [
              models.Index(fields=['city ', 'element'])
          ]
  
  </code></pre>
  <p>My questions are regarding how to change the indices to have as few indices as possible but maintain the best performance possible.</p>
  <p>Since I have the <code>unique_together</code>, and <code>element</code> is the first entity in that index. Does it necessarily mean that I can change the <code>element</code> field to have <code>db_index=False</code> since I already have a combined index to this field?</p>
  <p>Since I have the index over <code>city</code> and <code>element</code> together, and <code>city</code> is the first entity in this index. Does it necessarily mean I can change the <code>city</code> field to have <code>db_index=False</code> since I probably don't need a dedicated index for it?</p>
  <p>Alternatively (instead of doing the previous changes mentioned), since I have the <code>unique_together</code> and also the <code>Index</code>. If I will reorder the <code>unique_together</code> to be over <code>(city, element, date_created)</code>, will it make the index over <code>(city, element)</code> redundant and can be deleted without hurting performance?</p>