From 1c9e9213111471613c40ed74d7c0917b560b89f1 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Tue, 21 Jul 2020 14:57:49 -0500 Subject: [Database] Add index on statuses.visibility column --- db/migrate/20200721195456_add_index_on_statuses_visibility.rb | 7 +++++++ db/schema.rb | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20200721195456_add_index_on_statuses_visibility.rb (limited to 'db') diff --git a/db/migrate/20200721195456_add_index_on_statuses_visibility.rb b/db/migrate/20200721195456_add_index_on_statuses_visibility.rb new file mode 100644 index 000000000..c45405e95 --- /dev/null +++ b/db/migrate/20200721195456_add_index_on_statuses_visibility.rb @@ -0,0 +1,7 @@ +class AddIndexOnStatusesVisibility < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + add_index :statuses, :visibility, where: 'deleted_at IS NULL', algorithm: :concurrently, name: :index_statuses_on_visibility + end +end diff --git a/db/schema.rb b/db/schema.rb index aa0790fc6..674ff8ab6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_07_21_184347) do +ActiveRecord::Schema.define(version: 2020_07_21_195456) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -811,6 +811,7 @@ ActiveRecord::Schema.define(version: 2020_07_21_184347) do t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id" t.index ["reblog_of_id", "account_id"], name: "index_statuses_on_reblog_of_id_and_account_id" t.index ["uri"], name: "index_statuses_on_uri", unique: true + t.index ["visibility"], name: "index_statuses_on_visibility", where: "(deleted_at IS NULL)" end create_table "statuses_tags", id: false, force: :cascade do |t| -- cgit