1
0
mirror of synced 2026-08-06 07:46:54 +00:00

PERF: Create index ON ai_topics_embeddings(topic_id, model_id) (#1513)

This index helps to speed up queries that joins the `topics` table
against the `ai_topics_embeddings` table on the `topic_id` column. There
are a number of queries which filters on `ai_topics_embeddings.model_id`
so we are including that in the index as well.
This commit is contained in:
Alan Guo Xiang Tan
2025-07-22 16:46:56 +08:00
committed by GitHub
parent 1d88ca44f0
commit cc77e73cfd
@@ -0,0 +1,11 @@
# frozen_string_literal: true
class AddIndexToAiTopicsEmbeddings < ActiveRecord::Migration[7.2]
def up
add_index :ai_topics_embeddings, %i[topic_id model_id]
end
def down
raise ActiveRecord::IrreversibleMigration
end
end