Follow-up from "Migrate AiUsageData.codeSuggestionEvents endpoint to the new model"
The following discussion from !199965 (closed) should be addressed:
-
@ahegyi started a discussion: Using the in-operator optimization with extra filters requires the filters to be also covered with an index. Given that we allow multiple event types to be filtered, we need to xtend the in-operator array scope to include the event values: https://docs.gitlab.com/development/database/efficient_in_operator_queries/#multiple-in-queries
- Add an index to include the
eventcolumn as well:"index_ai_usage_events_on_namespace_id_timestamp_and_id" btree (namespace_id, event, "timestamp", id) - Update the query to build the cartesian product of namespace ids and event ids. (if event filter is used)
This can be a follow up.
- Add an index to include the
Edited by 🤖 GitLab Bot 🤖