Limit the returned db.Querier to the requested time range (#351)
Limit the returned `db.Querier` to the requested time range. Preallocate the `baseChunkSeries.lset` and `baseChunkSeries.chks` slices to the previous series' slice sizes to avoid unnecessary grow slice reallocations.
This commit is contained in:
parent
e4843938ba
commit
171fc4ab5d
6
db.go
6
db.go
|
@ -793,7 +793,11 @@ func (db *DB) Querier(mint, maxt int64) (Querier, error) {
|
|||
}
|
||||
}
|
||||
if maxt >= db.head.MinTime() {
|
||||
blocks = append(blocks, db.head)
|
||||
blocks = append(blocks, &rangeHead{
|
||||
head: db.head,
|
||||
mint: mint,
|
||||
maxt: maxt,
|
||||
})
|
||||
}
|
||||
|
||||
sq := &querier{
|
||||
|
|
|
@ -499,8 +499,8 @@ func (s *baseChunkSeries) Err() error { return s.err }
|
|||
|
||||
func (s *baseChunkSeries) Next() bool {
|
||||
var (
|
||||
lset labels.Labels
|
||||
chkMetas []chunks.Meta
|
||||
lset = make(labels.Labels, len(s.lset))
|
||||
chkMetas = make([]chunks.Meta, len(s.chks))
|
||||
err error
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue