Skip to content

Commit

Permalink
Remove low-scan high-write indexes. #195
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Jun 30, 2015
1 parent 5f98f08 commit d899afd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
13 changes: 13 additions & 0 deletions db/migrate/20150630080602_remove_low_scan_high_write_indexes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class RemoveLowScanHighWriteIndexes < ActiveRecord::Migration
def change
remove_index(:replies, :column => :state)
remove_index(:chats, :column => :updated_at)
remove_index(:chats, :column => [:starter_type, :starter_id])
remove_index(:chats, :column => :friend_id)
remove_index(:charge_requests, :column => ["updated_at", "state"])
remove_index(:users, :column => :latest_charge_request_id)
remove_index(:users, :column => :operator_name)
remove_index(:users, :column => :state)
remove_index(:users, :column => :active_chat_id)
end
end
11 changes: 1 addition & 10 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150630071537) do
ActiveRecord::Schema.define(version: 20150630080602) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -51,7 +51,6 @@
end

add_index "charge_requests", ["requester_type", "requester_id"], name: "index_charge_requests_on_requester_type_and_requester_id", using: :btree
add_index "charge_requests", ["updated_at", "state"], name: "index_charge_requests_on_updated_at_and_state", using: :btree
add_index "charge_requests", ["user_id"], name: "index_charge_requests_on_user_id", using: :btree

create_table "chats", force: :cascade do |t|
Expand All @@ -63,9 +62,6 @@
t.string "starter_type", limit: 255
end

add_index "chats", ["friend_id"], name: "index_chats_on_friend_id", using: :btree
add_index "chats", ["starter_type", "starter_id"], name: "index_chats_on_starter_type_and_starter_id", using: :btree
add_index "chats", ["updated_at"], name: "index_chats_on_updated_at", using: :btree
add_index "chats", ["user_id", "friend_id"], name: "index_chats_on_user_id_and_friend_id", unique: true, using: :btree

create_table "locations", force: :cascade do |t|
Expand Down Expand Up @@ -178,7 +174,6 @@

add_index "replies", ["chat_id"], name: "index_replies_on_chat_id", using: :btree
add_index "replies", ["msisdn_discovery_id"], name: "index_replies_on_msisdn_discovery_id", using: :btree
add_index "replies", ["state"], name: "index_replies_on_state", using: :btree
add_index "replies", ["token"], name: "index_replies_on_token", unique: true, using: :btree
add_index "replies", ["user_id"], name: "index_replies_on_user_id", using: :btree

Expand All @@ -199,12 +194,8 @@
t.integer "latest_charge_request_id"
end

add_index "users", ["active_chat_id"], name: "index_users_on_active_chat_id", using: :btree
add_index "users", ["date_of_birth"], name: "index_users_on_date_of_birth", using: :btree
add_index "users", ["latest_charge_request_id"], name: "index_users_on_latest_charge_request_id", using: :btree
add_index "users", ["mobile_number"], name: "index_users_on_mobile_number", unique: true, using: :btree
add_index "users", ["operator_name"], name: "index_users_on_operator_name", using: :btree
add_index "users", ["state"], name: "index_users_on_state", using: :btree

add_foreign_key "msisdn_discoveries", "msisdn_discovery_runs"
add_foreign_key "msisdn_discoveries", "msisdns"
Expand Down

0 comments on commit d899afd

Please sign in to comment.