Skip to content

feature_gates query running extremely frequently

The stats for this query:

SELECT "feature_gates".* FROM "feature_gates" WHERE "feature_gates"."feature_key" = ?

are interesting: https://performance.gitlab.net/dashboard/db/postgres-single-query-drill-down?orgId=1&from=now-7d&to=now&var-environment=prd&var-queryid=1083159295&var-fqdn=All

It's extremely fast (20us on the database, about 300us round trip to the client) however we're running it extremely often. about 500/s. I expect these values don't change nearly that often...

Could we not cache these values in the application in a ruby hash and only fetch them once a minute or so?

Edited by 🤖 GitLab Bot 🤖