This repository has been archived by the owner on Sep 5, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Significant (98.87%) improvement in the speed up Vehicles#Current dat…
…abase queries. 1046ms -> 1ms
- Loading branch information
Showing
2 changed files
with
12 additions
and
1 deletion.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
db/migrate/20101204232129_add_vehicle_timestamp_index_to_updates.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class AddVehicleTimestampIndexToUpdates < ActiveRecord::Migration | ||
def self.up | ||
add_index :updates, [:vehicle_id, :timestamp] | ||
end | ||
|
||
def self.down | ||
remove_index :updates, [:vehicle_id, :timestamp] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters