-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CV2-5138: add more index to improve performance
- Loading branch information
Showing
6 changed files
with
191 additions
and
140 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
db/migrate/20240924121509_add_index_to_created_at_for_tipline_request.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,10 @@ | ||
class AddIndexToCreatedAtForTiplineRequest < ActiveRecord::Migration[6.1] | ||
def change | ||
execute "CREATE INDEX tipline_request_created_at_year ON tipline_requests (date_trunc('year', created_at))" | ||
execute "CREATE INDEX tipline_request_created_at_quarter ON tipline_requests (date_trunc('quarter', created_at))" | ||
execute "CREATE INDEX tipline_request_created_at_month ON tipline_requests (date_trunc('month', created_at))" | ||
execute "CREATE INDEX tipline_request_created_at_week ON tipline_requests (date_trunc('week', created_at))" | ||
execute "CREATE INDEX tipline_request_created_at_day ON tipline_requests (date_trunc('day', created_at))" | ||
add_index :tipline_requests, :created_at | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
db/migrate/20240924121533_add_index_to_created_at_for_tipline_message.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,10 @@ | ||
class AddIndexToCreatedAtForTiplineMessage < ActiveRecord::Migration[6.1] | ||
def change | ||
execute "CREATE INDEX tipline_message_created_at_year ON tipline_messages (date_trunc('year', created_at))" | ||
execute "CREATE INDEX tipline_message_created_at_quarter ON tipline_messages (date_trunc('quarter', created_at))" | ||
execute "CREATE INDEX tipline_message_created_at_month ON tipline_messages (date_trunc('month', created_at))" | ||
execute "CREATE INDEX tipline_message_created_at_week ON tipline_messages (date_trunc('week', created_at))" | ||
execute "CREATE INDEX tipline_message_created_at_day ON tipline_messages (date_trunc('day', created_at))" | ||
add_index :tipline_messages, :created_at | ||
end | ||
end |
7 changes: 7 additions & 0 deletions
7
db/migrate/20240924130424_add_created_at_index_for_data_points.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,7 @@ | ||
class AddCreatedAtIndexForDataPoints < ActiveRecord::Migration[6.1] | ||
def change | ||
add_index :tipline_subscriptions, :created_at | ||
add_index :tipline_newsletter_deliveries, :created_at | ||
add_index :annotations, :created_at | ||
end | ||
end |
Oops, something went wrong.