You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 2, 2024. It is now read-only.
Filter by label key before Exists() for LabelValues() in multi-tenancy mode.
Signed-off-by: Harkishen-Singh <[email protected]>
This commit optimizes the LabelValues() for multi-tenancy case by filtering
the label name before the expensive Exists() subclause.
name: "Tenant values are filtered when tenant is configured",
170
170
sqlQueries: []model.SqlQuery{
171
171
{
172
-
Sql: "SELECT array_agg(distinct a.value) FROM (SELECT * FROM _prom_catalog.label l WHERE EXISTS( SELECT 1 FROM _prom_catalog.series WHERE ( labels @> array[l.id] AND labels @> ( SELECT array_agg(id :: INTEGER) FROM _prom_catalog.label WHERE key = '__tenant__' AND value = $1 )::int[] ) ) ) a WHERE a.key = $2",
173
-
Args: []interface{}{"a", "__tenant__"},
172
+
Sql: "SELECT array_agg(distinct value) FROM (SELECT * FROM _prom_catalog.label l WHERE key = $1 AND ( EXISTS( SELECT 1 FROM _prom_catalog.series WHERE ( labels @> array[l.id] AND labels && ( SELECT array_agg(id :: INTEGER) FROM _prom_catalog.label WHERE key = '__tenant__' AND value = $2 )::int[] ) ) )) a",
0 commit comments