[index] Add index on status_stats.created_at

This commit is contained in:
Fosco Marotto 2021-01-03 15:02:40 -05:00
parent 46ceced444
commit 7a58d0fa58
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,7 @@
class AddIndexOnStatusStatsCreatedAt < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def change
add_index :status_stats, :created_at, algorithm: :concurrently
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_01_02_225500) do
ActiveRecord::Schema.define(version: 2021_01_03_150000) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
@ -730,6 +730,7 @@ ActiveRecord::Schema.define(version: 2021_01_02_225500) do
t.bigint "favourites_count", default: 0, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["created_at"], name: "index_status_stats_on_created_at"
t.index ["favourites_count"], name: "index_status_stats_on_favourites_count"
t.index ["reblogs_count"], name: "index_status_stats_on_reblogs_count"
t.index ["replies_count"], name: "index_status_stats_on_replies_count"