Add index for `answers.created_at`
This improves query time for the public timeline
This commit is contained in:
parent
fc75b222c1
commit
b5b4f11056
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddIndexForCreatedAtOnAnswers < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_index :answers, :created_at, order: :desc
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2023_02_12_181044) do
|
||||
ActiveRecord::Schema.define(version: 2023_02_18_142952) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -49,6 +49,7 @@ ActiveRecord::Schema.define(version: 2023_02_12_181044) do
|
|||
t.datetime "updated_at"
|
||||
t.integer "smile_count", default: 0, null: false
|
||||
t.datetime "pinned_at"
|
||||
t.index ["created_at"], name: "index_answers_on_created_at", order: :desc
|
||||
t.index ["question_id"], name: "index_answers_on_question_id"
|
||||
t.index ["user_id", "created_at"], name: "index_answers_on_user_id_and_created_at"
|
||||
t.index ["user_id", "pinned_at"], name: "index_answers_on_user_id_and_pinned_at"
|
||||
|
|
Loading…
Reference in New Issue