Skip to content

Commit

Permalink
add index on stream_entries table (mastodon#5793)
Browse files Browse the repository at this point in the history
  • Loading branch information
takayamaki authored and Gargron committed Nov 30, 2017
1 parent f0d4c7d commit dc1ebd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions db/migrate/20171129172043_add_index_on_stream_entries.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddIndexOnStreamEntries < ActiveRecord::Migration[5.1]
def change
commit_db_transaction
add_index :stream_entries, [:account_id, :activity_type, :id], algorithm: :concurrently
remove_index :stream_entries, name: :index_stream_entries_on_account_id
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20171125190735) do
ActiveRecord::Schema.define(version: 20171129172043) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -431,7 +431,7 @@
t.datetime "updated_at", null: false
t.boolean "hidden", default: false, null: false
t.bigint "account_id"
t.index ["account_id"], name: "index_stream_entries_on_account_id"
t.index ["account_id", "activity_type", "id"], name: "index_stream_entries_on_account_id_and_activity_type_and_id"
t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type"
end

Expand Down

0 comments on commit dc1ebd4

Please sign in to comment.