Follow-up from "Add FF for SaaS GA release of Semantic Code Search"

The following discussion from !215170 should be addressed:

  • @partiaga started a discussion: (+2 comments)

    Hi @Andyschoenen - would you be able to do the database maintainer review again here?

    I had to rebase this over another MR, and one of the queries now have additional conditions in the WHERE clause:

    WHERE  "namespaces"."type" = 'Group'  AND "namespaces"."parent_id" IS NULL 

I found a query that returns results: https://console.postgres.ai/shared/f26fa074-6b7a-4d9a-b900-bc5fdbb1393c

I think a partial index on namespace_settings would be great for this query

CREATE INDEX idx_namespace_settings_on_namespace_id_and_experiment_features 
ON namespace_settings(namespace_id, experiment_features_enabled) 
WHERE experiment_features_enabled = TRUE;

This improved it: https://console.postgres.ai/shared/cff638c8-9d44-4594-9ab2-7634faa85d40

However, I think this is out of scope for this MR since we were filtering for experiment_features_enabled before. Let's address this in a follow-up.