From 45a63a1da90b6e84fe6cd091eb81df2238384c97 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 3 Feb 2021 18:43:50 +0200 Subject: [PATCH] sort orSuffixes in tagFilter.InitFromGraphiteQuery for faster seeks --- lib/storage/tag_filters.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/storage/tag_filters.go b/lib/storage/tag_filters.go index 6785d96caf..4fc38605b9 100644 --- a/lib/storage/tag_filters.go +++ b/lib/storage/tag_filters.go @@ -264,6 +264,9 @@ func (tf *tagFilter) InitFromGraphiteQuery(commonPrefix, query []byte, paths []s if len(orSuffixes) == 0 { orSuffixes = append(orSuffixes, "") } + // Sort orSuffixes for faster seek later. + sort.Strings(orSuffixes) + tf.key = append(tf.key[:0], "__graphite__"...) tf.value = append(tf.value[:0], query...) tf.isNegative = isNegative