Improve CIF Indexes
This commit is contained in:
		
							parent
							
								
									652d900618
								
							
						
					
					
						commit
						a2c5bd49ff
					
				| @ -154,6 +154,7 @@ func RemoveOutdatedServices(cutoff time.Time) (count int64, err error) { | ||||
| 
 | ||||
| // Creates indexes on the Timetable collection... Index suitability needs checking. | ||||
| func CreateTimetableIndexes() error { | ||||
| 	log.Info("Creating timetable indexes") | ||||
| 	coll := MongoClient.Database(DatabaseName).Collection(TimetableCollection) | ||||
| 	indexModels := []mongo.IndexModel{ | ||||
| 		{ | ||||
| @ -163,22 +164,13 @@ func CreateTimetableIndexes() error { | ||||
| 				{Key: "scheduleStartDate", Value: 1}, | ||||
| 			}, | ||||
| 			Options: options.Index().SetName("delete_query"), | ||||
| 		}, | ||||
| 		{ | ||||
| 			Keys: bson.D{ | ||||
| 				{Key: "trainUid", Value: 1}, | ||||
| 				{Key: "scheduleStartDate", Value: 1}, | ||||
| 				{Key: "scheduleEndDate", Value: 1}, | ||||
| 				{Key: "daysRun", Value: 1}, | ||||
| 			}, | ||||
| 			Options: options.Index().SetName("find_by_uid"), | ||||
| 		}, | ||||
| 		}, // The find by UID Query can make use of the delete_query index | ||||
| 		{ | ||||
| 			Keys: bson.D{ | ||||
| 				{Key: "headcode", Value: 1}, | ||||
| 				{Key: "daysRun", Value: 1}, | ||||
| 				{Key: "scheduleStartDate", Value: 1}, | ||||
| 				{Key: "scheduleEndDate", Value: 1}, | ||||
| 				{Key: "daysRun", Value: 1}, | ||||
| 			}, | ||||
| 			Options: options.Index().SetName("find_by_headcode"), | ||||
| 		}, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user