influxdata / influxdata/influxdb

Feature Request: DatePart in InfluxQL

Open
#6,723 38 comments 56 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1.x area/queries flux/triaged kind/feature-request
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Can we have InfluxQL support DatePart which is supported in almost all SQL engines? The use case is to analyze long term trend over a wide time scale, but only part of the range.

Example use cases.
1. Server utilization during business hours, we will have a data point at every 10 seconds, but we want to trend business hour vs non business hour utilization
2. Data/requests/hit volume on first of the month over time, we can always have a grafana plot the entire timescale, but that kind of overloads the analysis, I rather have a graph where I can compare 1st of every month data over last 10 years.

Proposal:
Have support for DatePart with only one argument (as we have the timescale as fixed argument), which will apply the filter on the timescale.
e.g. Select \* from Host_Metrics where DatePart(hour)>8 and DatePart(hour)<17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed InfluxQL DatePart(hour) syntax and the two time-range examples in this issue. Review the 38-comment discussion for the unresolved behavior and design constraints. Done means agreeing on the supported DatePart semantics and implementing and validating the feature in the relevant query path, though no files or tests are named here.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.