sort orSuffixes in tagFilter.InitFromGraphiteQuery for faster seeks

This commit is contained in:
Aliaksandr Valialkin 2021-02-03 18:43:50 +02:00
parent 785b770af3
commit 45a63a1da9

View File

@ -264,6 +264,9 @@ func (tf *tagFilter) InitFromGraphiteQuery(commonPrefix, query []byte, paths []s
if len(orSuffixes) == 0 { if len(orSuffixes) == 0 {
orSuffixes = append(orSuffixes, "") orSuffixes = append(orSuffixes, "")
} }
// Sort orSuffixes for faster seek later.
sort.Strings(orSuffixes)
tf.key = append(tf.key[:0], "__graphite__"...) tf.key = append(tf.key[:0], "__graphite__"...)
tf.value = append(tf.value[:0], query...) tf.value = append(tf.value[:0], query...)
tf.isNegative = isNegative tf.isNegative = isNegative