ai tags: replace tag_id index with (tag_id, score) index.

Index on (tag_id, score) instead of (tag_id) to allow tags to be
filtered and sorted by confidence more efficiently. This index takes up
about the same amount of space as an index on tag_id alone, so including
the score in the index is essentially free.
This commit is contained in:
evazion
2022-06-27 17:34:19 -05:00
parent ab7462a42d
commit fb926a1bd2
2 changed files with 10 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
class AddTagIdAndScoreIndexToAITags < ActiveRecord::Migration[7.0]
def change
add_index :ai_tags, [:tag_id, :score], if_not_exists: true
remove_index :ai_tags, :tag_id
end
end