Changes between Initial Version and Version 24 of Ticket #22125
- Timestamp:
- Oct 30, 2018, 1:29:34 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #22125
- Property Owner changed from to
- Property Triage Stage Unreviewed → Accepted
- Property Has patch set
- Property Easy pickings unset
- Property Version 1.6 → master
- Property Patch needs improvement set
- Property Keywords db-indexes added
- Property Cc added
-
Ticket #22125 – Description
initial v24 1 1 Suppose I have the following model: 2 {{{ 2 3 class Food(models.Model): 3 4 restaurants = models.ManyToManyField(Restaurant) 4 5 }}} 5 6 The following table is created: 6 7 {{{ 7 8 CREATE TABLE "main_food_restaurants" ( 8 9 "id" integer NOT NULL PRIMARY KEY, … … 11 12 UNIQUE ("food_id", "restaurant_id") 12 13 ) 13 14 }}} 14 15 and the indexes: 15 16 {{{ 16 17 CREATE INDEX "main_food_restaurants_0899c464" ON "main_food_restaurants" ("food_id"); 17 18 CREATE 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 }}} 20 Notice that the single index on food_id is not needed due to the unique index `(food_id, restaurant_id)`.