diff --git a/lib/storage/index_db.go b/lib/storage/index_db.go index d4b4704f1..ce5858b95 100644 --- a/lib/storage/index_db.go +++ b/lib/storage/index_db.go @@ -1561,6 +1561,7 @@ func (is *indexSearch) updateMetricIDsForTagFilters(metricIDs map[uint64]struct{ // Find intersection of minTf with other tfs. var tfsPostponed []*tagFilter + successfulIntersects := 0 for i := range tfs.tfs { tf := &tfs.tfs[i] if tf == minTf { @@ -1577,6 +1578,10 @@ func (is *indexSearch) updateMetricIDsForTagFilters(metricIDs map[uint64]struct{ return err } minMetricIDs = mIDs + successfulIntersects++ + } + if len(tfsPostponed) > 0 && successfulIntersects == 0 { + return is.updateMetricIDsByMetricNameMatch(metricIDs, minMetricIDs, tfsPostponed) } for i, tf := range tfsPostponed { mIDs, err := is.intersectMetricIDsWithTagFilter(tf, minMetricIDs)