# Time weighted queries

**URL:** <https://community.influxdata.com/t/time-weighted-queries/192>\
**Category:** Systems\
**Tags:** influxdb, time-series\
**Created:** [March 10, 2017, 8:03pm UTC](https://community.influxdata.com/t/time-weighted-queries/192 "2017-03-10T20:03:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rhys\_Kirk\_TGG](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@Rhys\_Kirk\_TGG](https://community.influxdata.com/u/Rhys_Kirk_TGG)\
**Post date:** [March 10, 2017, 8:03pm UTC](https://community.influxdata.com/t/time-weighted-queries/192/1 "2017-03-10T20:03:04Z")

</div>

Are there plans for supporting time weighted queries in InfluxDB?  
For example, if I am recording the RPM of some equipment then I want to know the total time (typically in seconds) that the RPM was \> than a threshold within a varying time window. This is typically a dynamic search request from a user so trying to pre-calculate it is not particularly useful here.

---

<div class="post-metadata">

**Author:** ![dgnorton](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/dgnorton/32/40_2.png) [@dgnorton](https://community.influxdata.com/u/dgnorton)\
**Post date:** [March 14, 2017, 7:51pm UTC](https://community.influxdata.com/t/time-weighted-queries/192/2 "2017-03-14T19:51:51Z")

</div>

@Rhys_Kirk_TGG there’s an [open feature request to add time weighted queries](https://github.com/influxdata/influxdb/issues/7445). It’s not currently assigned to a release milestone. See if the requested feature lines up with what you need. Feedback on the issue is welcomed & encouraged.

---

<div class="post-metadata">

**Author:** ![Rhys\_Kirk\_TGG](https://avatars.discourse-cdn.com/v4/letter/r/eada6e/32.png) [@Rhys\_Kirk\_TGG](https://community.influxdata.com/u/Rhys_Kirk_TGG)\
**Post date:** [March 15, 2017, 1:32pm UTC](https://community.influxdata.com/t/time-weighted-queries/192/3 "2017-03-15T13:32:14Z")

</div>

That issue only focuses on the mean value weighted by time.  
There are a few other scenarios, like total time true for a query (e.g. total time compressor \> ‘x’ rpm within last 7 days). Obviously the time range is configurable so it would need to be a low impact query.

At the moment you would need to hack it with a daily totaliser for each field you want the ‘time true’ result for, running that totaliser each second, then something like a stdev per day.

A slight irony that a time-series database doesn’t support time weighted functions?

---

<div class="post-metadata">

**Author:** ![jackzampolin](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jackzampolin/32/5_2.png) [@jackzampolin](https://community.influxdata.com/u/jackzampolin)\
**Post date:** [March 15, 2017, 4:37pm UTC](https://community.influxdata.com/t/time-weighted-queries/192/4 "2017-03-15T16:37:59Z")

</div>

@Rhys_Kirk_TGG We have had a lot of requests for this feature however everyone I’ve heard from has asked for different tine weighting methods. If you could comment on that issue with exactly what you are looking for it would help us implement the feature.
