Skip to content

Commit

Permalink
account_deletions get stuck while selecting participations
Browse files Browse the repository at this point in the history
Following query takes over 20 minutes and fills up the database:
SELECT * FROM participations WHERE author_id = XXXXX

On servers with a huge participations-table this is a serious
performance issue which is easily fixed by the author_id index

Signed-off-by: Lukas Matt <lukas@zauberstuhl.de>
  • Loading branch information
Lukas Matt authored and denschub committed Mar 30, 2016
1 parent 4617629 commit a3ac1e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.md
Expand Up @@ -2,6 +2,7 @@

## Refactor
* Sort tag autocompletion by tag name [#6734](https://github.com/diaspora/diaspora/pull/6734)
* Make account deletions faster by adding an index [#6771](https://github.com/diaspora/diaspora/pull/6771)

## Bug fixes
* Fix empty name field when editing aspect names [#6706](https://github.com/diaspora/diaspora/pull/6706)
Expand Down
@@ -0,0 +1,5 @@
class AddAuthorIdIndexToParticipations < ActiveRecord::Migration
def change
add_index :participations, :author_id, :using => :btree
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20150724152052) do
ActiveRecord::Schema.define(version: 20160327103605) do

create_table "account_deletions", force: :cascade do |t|
t.string "diaspora_handle", limit: 255
Expand Down Expand Up @@ -262,6 +262,7 @@
t.datetime "updated_at", null: false
end

add_index "participations", ["author_id"], name: "index_participations_on_author_id", using: :btree
add_index "participations", ["guid"], name: "index_participations_on_guid", length: {"guid"=>191}, using: :btree
add_index "participations", ["target_id", "target_type", "author_id"], name: "index_participations_on_target_id_and_target_type_and_author_id", using: :btree

Expand Down

0 comments on commit a3ac1e3

Please sign in to comment.