mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
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() {
|
if maxt >= db.head.MinTime() {
|
||||||
blocks = append(blocks, db.head)
|
blocks = append(blocks, &rangeHead{
|
||||||
|
head: db.head,
|
||||||
|
mint: mint,
|
||||||
|
maxt: maxt,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
sq := &querier{
|
sq := &querier{
|
||||||
|
|
|
@ -499,8 +499,8 @@ func (s *baseChunkSeries) Err() error { return s.err }
|
||||||
|
|
||||||
func (s *baseChunkSeries) Next() bool {
|
func (s *baseChunkSeries) Next() bool {
|
||||||
var (
|
var (
|
||||||
lset labels.Labels
|
lset = make(labels.Labels, len(s.lset))
|
||||||
chkMetas []chunks.Meta
|
chkMetas = make([]chunks.Meta, len(s.chks))
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue