diff --git a/migrations/dlu/mysql/75_map_events_day_index.sql b/migrations/dlu/mysql/75_map_events_day_index.sql new file mode 100644 index 000000000..9a9c1260b --- /dev/null +++ b/migrations/dlu/mysql/75_map_events_day_index.sql @@ -0,0 +1,4 @@ +/* map_events_daily's key starts with the zone, so everything that reads it by day alone read the whole table: the + economy compaction (twice per day it merges into a month, a whole table scan each) and the reports over every zone. + The index holds only the day and the key, so adding events to a row (the game's upsert) never has to update it. */ +CREATE INDEX map_events_daily_day ON map_events_daily (day); diff --git a/migrations/dlu/sqlite/58_map_events_day_index.sql b/migrations/dlu/sqlite/58_map_events_day_index.sql new file mode 100644 index 000000000..54dfc0c99 --- /dev/null +++ b/migrations/dlu/sqlite/58_map_events_day_index.sql @@ -0,0 +1,2 @@ +/* map_events_daily by day, for the economy compaction and the reports over every zone: see the MySQL migration */ +CREATE INDEX IF NOT EXISTS map_events_daily_day ON map_events_daily (day);