mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 03:09:43 +00:00
DEV: Drop search index on non-pm posts.
The problem with this index is that on sites with a high non-pm to pm posts ratio, the index is esstentially duplicating the existing index on `PostSearchData#search_data`. If the site is huge, the index ends up taking up more diskspace.
This commit is contained in:
parent
c8faad62ad
commit
87de8948c0
@ -0,0 +1,11 @@
|
||||
class DropIdxRegularPostSearchData < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
execute <<~SQL
|
||||
DROP INDEX CONCURRENTLY IF EXISTS idx_regular_post_search_data
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
@ -34,13 +34,6 @@ class UpdatePrivateMessageOnPostSearchData < ActiveRecord::Migration[6.0]
|
||||
end
|
||||
|
||||
def up
|
||||
|
||||
# must drop index cause we do not want an enormous amount of work done
|
||||
# as we are changing data
|
||||
execute <<~SQL
|
||||
DROP INDEX CONCURRENTLY IF EXISTS idx_regular_post_search_data
|
||||
SQL
|
||||
|
||||
# Delete post_search_data of orphaned posts
|
||||
execute <<~SQL
|
||||
DELETE FROM post_search_data
|
||||
@ -69,11 +62,6 @@ class UpdatePrivateMessageOnPostSearchData < ActiveRecord::Migration[6.0]
|
||||
update_private_message_flag
|
||||
change_column_null(:post_search_data, :private_message, false)
|
||||
end
|
||||
|
||||
execute <<~SQL
|
||||
CREATE INDEX CONCURRENTLY idx_regular_post_search_data
|
||||
ON post_search_data USING GIN(search_data) WHERE NOT private_message
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
|
Loading…
x
Reference in New Issue
Block a user