Adding missing indexes on usage data

This commit is contained in:
Andrew Melton 2013-04-01 14:21:33 -04:00
parent fe27375b82
commit d6c441a507
3 changed files with 23 additions and 8 deletions

View File

@ -1,2 +1,9 @@
ALTER TABLE stacktach_instanceexists ADD `audit_period_beginning` numeric(20, 6);
ALTER TABLE stacktach_instanceexists ADD `audit_period_ending` numeric(20, 6);
ALTER TABLE stacktach_instanceexists ADD `audit_period_ending` numeric(20, 6);
CREATE INDEX `stacktach_instanceusage_987c9676` ON `stacktach_instanceusage` (`launched_at`);
CREATE INDEX `stacktach_instancedeletes_987c9676` ON `stacktach_instancedeletes` (`launched_at`);
CREATE INDEX `stacktach_instancedeletes_738c7e64` ON `stacktach_instancedeletes` (`deleted_at`);
CREATE INDEX `stacktach_instanceexists_987c9676` ON `stacktach_instanceexists` (`launched_at`);
CREATE INDEX `stacktach_instanceexists_738c7e64` ON `stacktach_instanceexists` (`deleted_at`);
CREATE INDEX `stacktach_instanceexists_23564986` ON `stacktach_instanceexists` (`audit_period_beginning`);
CREATE INDEX `stacktach_instanceexists_b891fefb` ON `stacktach_instanceexists` (`audit_period_ending`);

View File

@ -19,11 +19,18 @@ CREATE INDEX `stacktach_lifecycle_9b2555fd` ON `stacktach_lifecycle` (`last_stat
CREATE INDEX `stacktach_lifecycle_67421a0e` ON `stacktach_lifecycle` (`last_task_state`);
CREATE INDEX `stacktach_lifecycle_dcf9e5f3` ON `stacktach_lifecycle` (`last_raw_id`);
CREATE INDEX `stacktach_instanceusage_888b756a` ON `stacktach_instanceusage` (`instance`);
CREATE INDEX `stacktach_instanceusage_987c9676` ON `stacktach_instanceusage` (`launched_at`);
CREATE INDEX `stacktach_instanceusage_792812e8` ON `stacktach_instanceusage` (`request_id`);
CREATE INDEX `stacktach_instanceusage_f321fd7` ON `stacktach_instanceusage` (`instance_type_id`);
CREATE INDEX `stacktach_instancedeletes_888b756a` ON `stacktach_instancedeletes` (`instance`);
CREATE INDEX `stacktach_instancedeletes_987c9676` ON `stacktach_instancedeletes` (`launched_at`);
CREATE INDEX `stacktach_instancedeletes_738c7e64` ON `stacktach_instancedeletes` (`deleted_at`);
CREATE INDEX `stacktach_instancedeletes_365c3a01` ON `stacktach_instancedeletes` (`raw_id`);
CREATE INDEX `stacktach_instanceexists_888b756a` ON `stacktach_instanceexists` (`instance`);
CREATE INDEX `stacktach_instanceexists_987c9676` ON `stacktach_instanceexists` (`launched_at`);
CREATE INDEX `stacktach_instanceexists_738c7e64` ON `stacktach_instanceexists` (`deleted_at`);
CREATE INDEX `stacktach_instanceexists_23564986` ON `stacktach_instanceexists` (`audit_period_beginning`);
CREATE INDEX `stacktach_instanceexists_b891fefb` ON `stacktach_instanceexists` (`audit_period_ending`);
CREATE INDEX `stacktach_instanceexists_38373776` ON `stacktach_instanceexists` (`message_id`);
CREATE INDEX `stacktach_instanceexists_f321fd7` ON `stacktach_instanceexists` (`instance_type_id`);
CREATE INDEX `stacktach_instanceexists_c9ad71dd` ON `stacktach_instanceexists` (`status`);

View File

@ -79,7 +79,7 @@ class InstanceUsage(models.Model):
instance = models.CharField(max_length=50, null=True,
blank=True, db_index=True)
launched_at = models.DecimalField(null=True, max_digits=20,
decimal_places=6)
decimal_places=6, db_index=True)
request_id = models.CharField(max_length=50, null=True,
blank=True, db_index=True)
instance_type_id = models.CharField(max_length=50,
@ -92,9 +92,9 @@ class InstanceDeletes(models.Model):
instance = models.CharField(max_length=50, null=True,
blank=True, db_index=True)
launched_at = models.DecimalField(null=True, max_digits=20,
decimal_places=6)
decimal_places=6, db_index=True)
deleted_at = models.DecimalField(null=True, max_digits=20,
decimal_places=6)
decimal_places=6, db_index=True)
raw = models.ForeignKey(RawData, null=True)
@ -112,13 +112,14 @@ class InstanceExists(models.Model):
instance = models.CharField(max_length=50, null=True,
blank=True, db_index=True)
launched_at = models.DecimalField(null=True, max_digits=20,
decimal_places=6)
decimal_places=6, db_index=True)
deleted_at = models.DecimalField(null=True, max_digits=20,
decimal_places=6)
decimal_places=6, db_index=True)
audit_period_beginning = models.DecimalField(null=True, max_digits=20,
decimal_places=6)
decimal_places=6,
db_index=True)
audit_period_ending = models.DecimalField(null=True, max_digits=20,
decimal_places=6)
decimal_places=6, db_index=True)
message_id = models.CharField(max_length=50, null=True,
blank=True, db_index=True)
instance_type_id = models.CharField(max_length=50,