Changes between Initial Version and Version 24 of Ticket #22125


Ignore:
Timestamp:
Oct 30, 2018, 1:29:34 PM (6 years ago)
Author:
Tim Graham
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #22125

    • Property Owner changed from nobody to bwreilly
    • Property Triage Stage UnreviewedAccepted
    • Property Has patch set
    • Property Easy pickings unset
    • Property Version 1.6master
    • Property Patch needs improvement set
    • Property Keywords db-indexes added
    • Property Cc emorley@… Phil Krylov added
  • Ticket #22125 – Description

    initial v24  
    11Suppose I have the following model:
     2{{{
    23class Food(models.Model):
    34  restaurants = models.ManyToManyField(Restaurant)
    4 
     5}}}
    56The following table is created:
    6 
     7{{{
    78CREATE TABLE "main_food_restaurants" (
    89    "id" integer NOT NULL PRIMARY KEY,
     
    1112    UNIQUE ("food_id", "restaurant_id")
    1213)
    13 
     14}}}
    1415and the indexes:
    15 
     16{{{
    1617CREATE INDEX "main_food_restaurants_0899c464" ON "main_food_restaurants" ("food_id");
    1718CREATE INDEX "main_food_restaurants_be4c8f84" ON "main_food_restaurants" ("restaurant_id");
    18 
    19 Notice that  the single index on food_id is not needed due to the unique index (food_id, restaurant_id)
     19}}}
     20Notice that  the single index on food_id is not needed due to the unique index `(food_id, restaurant_id)`.
Back to Top